提交工程,小程序源码已完成,单片机待完成

This commit is contained in:
2026-02-10 20:21:41 +08:00
commit fd55a14b62
3778 changed files with 1062672 additions and 0 deletions

View File

@@ -0,0 +1 @@
export {};

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);
},
},
});

View File

@@ -0,0 +1,3 @@
{
"component": true
}

View File

@@ -0,0 +1,3 @@
<view class="van-sidebar custom-class">
<slot />
</view>

View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-sidebar{width:var(--sidebar-width,80px)}