This commit is contained in:
zoujiandong
2024-01-22 08:55:30 +08:00
parent 22f3da6c33
commit 2bd2fd31ac
3460 changed files with 136738 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export {};
+34
View File
@@ -0,0 +1,34 @@
import { VantComponent } from '../common/component';
import { useChildren } from '../common/relation';
VantComponent({
relation: useChildren('sidebar-item', function () {
this.setActive(this.data.activeKey);
}),
props: {
activeKey: {
type: Number,
value: 0,
observer: 'setActive',
},
},
beforeCreate() {
this.currentActive = -1;
},
methods: {
setActive(activeKey) {
const { children, currentActive } = this;
if (!children.length) {
return Promise.resolve();
}
this.currentActive = activeKey;
const stack = [];
if (currentActive !== activeKey && children[currentActive]) {
stack.push(children[currentActive].setActive(false));
}
if (children[activeKey]) {
stack.push(children[activeKey].setActive(true));
}
return Promise.all(stack);
},
},
});
+3
View File
@@ -0,0 +1,3 @@
{
"component": true
}
+3
View File
@@ -0,0 +1,3 @@
<view class="van-sidebar custom-class">
<slot />
</view>
+1
View File
@@ -0,0 +1 @@
@import '../common/index.wxss';.van-sidebar{width:var(--sidebar-width,80px)}