You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
897 B
43 lines
897 B
4 years ago
|
import { createNamespace } from '../utils';
|
||
|
import { ParentMixin } from '../mixins/relation';
|
||
|
|
||
|
var _createNamespace = createNamespace('sidebar'),
|
||
|
createComponent = _createNamespace[0],
|
||
|
bem = _createNamespace[1];
|
||
|
|
||
|
export default createComponent({
|
||
|
mixins: [ParentMixin('vanSidebar')],
|
||
|
model: {
|
||
|
prop: 'activeKey'
|
||
|
},
|
||
|
props: {
|
||
|
activeKey: {
|
||
|
type: [Number, String],
|
||
|
default: 0
|
||
|
}
|
||
|
},
|
||
|
data: function data() {
|
||
|
return {
|
||
|
index: +this.activeKey
|
||
|
};
|
||
|
},
|
||
|
watch: {
|
||
|
activeKey: function activeKey() {
|
||
|
this.setIndex(+this.activeKey);
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
setIndex: function setIndex(index) {
|
||
|
if (index !== this.index) {
|
||
|
this.index = index;
|
||
|
this.$emit('change', index);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
render: function render() {
|
||
|
var h = arguments[0];
|
||
|
return h("div", {
|
||
|
"class": bem()
|
||
|
}, [this.slots()]);
|
||
|
}
|
||
|
});
|