未验证 提交 3d781aaa 编写于 作者: D Drjingfubo 提交者: GitHub

fix(tabbar): remove watch (#2196)

上级 15b86792
...@@ -123,7 +123,7 @@ export default create({ ...@@ -123,7 +123,7 @@ export default create({
} }
}; };
relation(getCurrentInstance() as ComponentInternalInstance); relation(getCurrentInstance() as ComponentInternalInstance);
const active = computed(() => state.index === state.active); const active = computed(() => state.index === parent.modelValue);
function change() { function change() {
let key = props.name ?? state.index; let key = props.name ?? state.index;
let index = null; let index = null;
...@@ -134,25 +134,6 @@ export default create({ ...@@ -134,25 +134,6 @@ export default create({
} }
parent.changeIndex(index ?? key, state.index); parent.changeIndex(index ?? key, state.index);
} }
const choosed = computed(() => {
if (parent) {
return parent.modelValue;
}
return null;
});
watch(choosed, (value, oldValue) => {
state.active = value;
let index = value;
if (props.name) {
index = parent.children.findIndex((item: { name: string | number }) => {
return item.name == value;
});
}
if (parent.children[index]?.href) {
window.location.href = parent.children[index].href;
}
});
return { return {
state, state,
active, active,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册