|
@@ -92,7 +92,7 @@ const getBreadcrumbList = (arr: RouteItems) => {
|
|
|
// 当前路由字符串切割成数组,并删除第一项空内容
|
|
// 当前路由字符串切割成数组,并删除第一项空内容
|
|
|
const initRouteSplit = (path: string) => {
|
|
const initRouteSplit = (path: string) => {
|
|
|
if (!themeConfig.value.isBreadcrumb) return false;
|
|
if (!themeConfig.value.isBreadcrumb) return false;
|
|
|
- console.log(path,route.name)
|
|
|
|
|
|
|
+ // console.log(path,route.name)
|
|
|
state.breadcrumbList = [];
|
|
state.breadcrumbList = [];
|
|
|
// state.breadcrumbList = [routesList.value[0]];
|
|
// state.breadcrumbList = [routesList.value[0]];
|
|
|
// state.routeSplit = path.split('/');
|
|
// state.routeSplit = path.split('/');
|
|
@@ -102,7 +102,7 @@ const initRouteSplit = (path: string) => {
|
|
|
//routeList 展开为一维数组
|
|
//routeList 展开为一维数组
|
|
|
state.routeLinkList=[]
|
|
state.routeLinkList=[]
|
|
|
toSimpleRouteList(routesList.value, "")
|
|
toSimpleRouteList(routesList.value, "")
|
|
|
- console.log(state.routeLinkList)
|
|
|
|
|
|
|
+ // console.log(state.routeLinkList)
|
|
|
// setTimeout(()=>{
|
|
// setTimeout(()=>{
|
|
|
state.breadcrumbList = state.routeLinkList.find(k => k.path === path).links
|
|
state.breadcrumbList = state.routeLinkList.find(k => k.path === path).links
|
|
|
// getBreadcrumbList(routesList.value);
|
|
// getBreadcrumbList(routesList.value);
|
|
@@ -110,7 +110,7 @@ const initRouteSplit = (path: string) => {
|
|
|
// if (state.breadcrumbList.length > 0)
|
|
// if (state.breadcrumbList.length > 0)
|
|
|
// state.breadcrumbList[state.breadcrumbList.length - 1].meta.tagsViewName = other.setTagsViewNameI18n(<RouteToFrom>route);
|
|
// state.breadcrumbList[state.breadcrumbList.length - 1].meta.tagsViewName = other.setTagsViewNameI18n(<RouteToFrom>route);
|
|
|
|
|
|
|
|
- console.log(state.breadcrumbList.map(k=>k.meta.title).join("-"))
|
|
|
|
|
|
|
+ // console.log(state.breadcrumbList.map(k=>k.meta.title).join("-"))
|
|
|
// },300)
|
|
// },300)
|
|
|
|
|
|
|
|
};
|
|
};
|
|
@@ -132,12 +132,12 @@ const toSimpleRouteList = (rs: RouteItems, parentPath: string) => {
|
|
|
}
|
|
}
|
|
|
// 页面加载时
|
|
// 页面加载时
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- console.log("onMounted")
|
|
|
|
|
|
|
+ // console.log("onMounted")
|
|
|
initRouteSplit(route.path);
|
|
initRouteSplit(route.path);
|
|
|
});
|
|
});
|
|
|
// 路由更新时
|
|
// 路由更新时
|
|
|
onBeforeRouteUpdate((to) => {
|
|
onBeforeRouteUpdate((to) => {
|
|
|
- console.log("onBeforeRouteUpdate")
|
|
|
|
|
|
|
+ // console.log("onBeforeRouteUpdate")
|
|
|
initRouteSplit(to.path);
|
|
initRouteSplit(to.path);
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|