You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
775 B
29 lines
775 B
import { useRoute } from "vue-router";
|
|
import { reactive } from "vue";
|
|
import { getNavInfoApi } from "../api/manage.js";
|
|
import { useStore } from "vuex";
|
|
|
|
export default function useTitleInfo() {
|
|
const route = useRoute()
|
|
const store = useStore()
|
|
const titleInfo = reactive({
|
|
title: '',
|
|
subTitle: ''
|
|
})
|
|
console.log(route, store)
|
|
const getTitle = () => {
|
|
getNavInfoApi({
|
|
title: store.getters.navList.find(it => it.link === route.path)?.title ?? ''
|
|
}).then(res => {
|
|
console.log('res', res)
|
|
if (res.data) {
|
|
titleInfo.title = res.data.title;
|
|
titleInfo.subTitle = res.data.description;
|
|
}
|
|
})
|
|
}
|
|
getTitle();
|
|
return titleInfo
|
|
|
|
}
|