perf: menu performance optimization
parent
d028cce23f
commit
e8b95784eb
|
@ -107,7 +107,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
keyMapStore.value = newKeyMapStore;
|
keyMapStore.value = newKeyMapStore;
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ flush: 'post' },
|
||||||
);
|
);
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.activeKey !== undefined) {
|
if (props.activeKey !== undefined) {
|
||||||
|
@ -209,12 +209,17 @@ export default defineComponent({
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let timeout: number;
|
||||||
const changeActiveKeys = (keys: Key[]) => {
|
const changeActiveKeys = (keys: Key[]) => {
|
||||||
if (props.activeKey === undefined) {
|
window.clearTimeout(timeout);
|
||||||
activeKeys.value = keys;
|
timeout = window.setTimeout(() => {
|
||||||
}
|
if (props.activeKey === undefined) {
|
||||||
emit('update:activeKey', keys[keys.length - 1]);
|
activeKeys.value = keys;
|
||||||
|
}
|
||||||
|
emit('update:activeKey', keys[keys.length - 1]);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const disabled = computed(() => !!props.disabled);
|
const disabled = computed(() => !!props.disabled);
|
||||||
const isRtl = computed(() => direction.value === 'rtl');
|
const isRtl = computed(() => direction.value === 'rtl');
|
||||||
const mergedMode = ref<MenuMode>('vertical');
|
const mergedMode = ref<MenuMode>('vertical');
|
||||||
|
@ -389,10 +394,8 @@ export default defineComponent({
|
||||||
));
|
));
|
||||||
const overflowedIndicator = <EllipsisOutlined />;
|
const overflowedIndicator = <EllipsisOutlined />;
|
||||||
|
|
||||||
// data-hack-store-update 初步判断是 vue bug,先用hack方式
|
|
||||||
return (
|
return (
|
||||||
<Overflow
|
<Overflow
|
||||||
data-hack-store-update={store.value}
|
|
||||||
prefixCls={`${prefixCls.value}-overflow`}
|
prefixCls={`${prefixCls.value}-overflow`}
|
||||||
component="ul"
|
component="ul"
|
||||||
itemComponent={MenuItem}
|
itemComponent={MenuItem}
|
||||||
|
|
Loading…
Reference in New Issue