[new feature] add IndexBar component

This commit is contained in:
陈嘉涵
2019-05-08 15:39:27 +08:00
parent e9854daf29
commit c92791e8da
19 changed files with 515 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
export function ChildrenMixin(parent) {
export function ChildrenMixin(parent, options = {}) {
const indexKey = options.indexKey || 'index';
return {
inject: {
[parent]: {
@@ -11,7 +13,7 @@ export function ChildrenMixin(parent) {
return this[parent];
},
index() {
[indexKey]() {
this.bindRelation();
return this.parent.children.indexOf(this);
}