chore(TreeSelect): onSidebarChange

This commit is contained in:
chenjiahan 2021-01-20 21:16:10 +08:00
parent bada315fb3
commit e253329a67

View File

@ -97,14 +97,19 @@ export default createComponent({
); );
}; };
const onSidebarChange = (index) => {
emit('update:mainActiveIndex', index);
emit('click-nav', index);
};
const renderSidebar = () => { const renderSidebar = () => {
const Items = props.items.map((item) => ( const Items = props.items.map((item) => (
<SidebarItem <SidebarItem
dot={item.dot} dot={item.dot}
title={item.text} title={item.text}
badge={item.badge} badge={item.badge}
disabled={item.disabled}
class={[bem('nav-item'), item.className]} class={[bem('nav-item'), item.className]}
disabled={item.disabled}
/> />
)); ));
@ -112,10 +117,7 @@ export default createComponent({
<Sidebar <Sidebar
class={bem('nav')} class={bem('nav')}
modelValue={props.mainActiveIndex} modelValue={props.mainActiveIndex}
onChange={(index) => { onChange={onSidebarChange}
emit('update:mainActiveIndex', index);
emit('click-nav', index);
}}
> >
{Items} {Items}
</Sidebar> </Sidebar>