mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 07:48:22 +08:00
improve menuitem route by vue3.4'defineModel
This commit is contained in:
parent
13505fdedc
commit
440dbf8aac
|
@ -8,7 +8,7 @@
|
|||
</template>
|
||||
{{ renderMenuTitle(item.title) }}
|
||||
</t-menu-item>
|
||||
<t-menu-item v-else :name="item.path" :value="getPath(item)" :to="item.path">
|
||||
<t-menu-item v-else :name="item.path" :value="getPath(item)" :to="item.path" @click="doMenuItemClick(item)">
|
||||
<template #icon>
|
||||
<component :is="menuIcon(item)" class="t-icon"></component>
|
||||
</template>
|
||||
|
@ -41,7 +41,8 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const active = computed(() => getActive());
|
||||
const active = defineModel<string>({ default: '' });
|
||||
//const active = computed(() => getActive());
|
||||
|
||||
const { locale } = useLocale();
|
||||
const list = computed(() => {
|
||||
|
@ -106,6 +107,11 @@ const getPath = (item: ListItemType) => {
|
|||
return item.meta?.single ? item.redirect : item.path;
|
||||
};
|
||||
|
||||
const doMenuItemClick = (item: ListItemType) => {
|
||||
//window.open(url);
|
||||
active.value= item.path;
|
||||
};
|
||||
|
||||
const openHref = (url: string) => {
|
||||
window.open(url);
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<component :is="getLogo()" :class="logoCls" />
|
||||
</span>
|
||||
</template>
|
||||
<menu-content :nav-data="menu" />
|
||||
<menu-content :nav-data="menu" v-model:active="active"/>
|
||||
<template #operations>
|
||||
<span :class="versionCls"> {{ !collapsed ? 'TDesign Starter' : '' }} {{ pgk.version }} </span>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue
Block a user