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