From e045fb159667e4472adbde88f9064fda9af044ec Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Wed, 26 Aug 2020 13:22:35 +0800 Subject: [PATCH] perf(SidebarItem): move onClick fn --- src/sidebar-item/index.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sidebar-item/index.js b/src/sidebar-item/index.js index e5632f2d3..9e1790f59 100644 --- a/src/sidebar-item/index.js +++ b/src/sidebar-item/index.js @@ -21,21 +21,21 @@ export default createComponent({ const route = useRoute(); const { parent, index } = useParent(SIDEBAR_KEY); + const onClick = () => { + if (props.disabled) { + return; + } + + emit('click', index.value); + parent.emit('update:modelValue', index.value); + parent.setActive(index.value); + route(); + }; + return () => { const { dot, badge, title, disabled } = props; const selected = index.value === parent.active(); - const onClick = () => { - if (disabled) { - return; - } - - emit('click', index.value); - parent.emit('update:modelValue', index.value); - parent.setActive(index.value); - route(); - }; - return (