fix(ApiTree): 多触发一次onchange

This commit is contained in:
invalid w 2023-10-19 10:52:30 +08:00
parent b103c64954
commit 882270d5ba
1 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<a-tree v-bind="getAttrs" @select="handleChange" v-model:selectedKeys="state"> <a-tree v-bind="getAttrs" v-model:selectedKeys="state">
<template #[item]="data" v-for="item in Object.keys($slots)"> <template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data || {}"></slot> <slot :name="item" v-bind="data || {}"></slot>
</template> </template>
@ -43,9 +43,6 @@
...attrs, ...attrs,
}; };
}); });
function handleChange(...args) {
emit('change', ...args);
}
watch( watch(
() => state.value, () => state.value,
@ -96,7 +93,7 @@
isFirstLoaded.value = true; isFirstLoaded.value = true;
emit('options-change', treeData.value); emit('options-change', treeData.value);
} }
return { getAttrs, loading, handleChange, state }; return { getAttrs, loading, state };
}, },
}); });
</script> </script>