[new feature] Sidebar: add to and replace prop (#3696)

This commit is contained in:
neverland
2019-06-29 17:16:54 +08:00
committed by GitHub
parent 514e44e621
commit 531fa6681e
3 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import { createNamespace } from '../utils';
import Info from '../info';
import { ChildrenMixin } from '../mixins/relation';
import { route, routeProps } from '../utils/router';
const [createComponent, bem] = createNamespace('sidebar-item');
@@ -8,7 +9,7 @@ export default createComponent({
mixins: [ChildrenMixin('vanSidebar')],
props: {
url: String,
...routeProps,
info: [String, Number],
title: String
},
@@ -23,13 +24,13 @@ export default createComponent({
onClick() {
this.$emit('click', this.index);
this.parent.$emit('change', this.index);
route(this.$router, this);
}
},
render(h) {
return (
<a
href={this.url}
class={[bem({ select: this.select }), 'van-hairline']}
onClick={this.onClick}
>