若依框架(路由跳转,如何动态修改tabs页的title )
代码】若依框架(路由跳转,如何动态修改tabs页的title )
·
//store/modules/tagsView.js页面中添加
const mutations = {
//动态改变tab 页签
EDIT_VISITED_VIEWS: (state, view) => {
for (var Index in state.visitedViews) {
console.log(state.visitedViews[Index].path)
if (state.visitedViews[Index].path == view.path) {
state.visitedViews[Index].title = view.meta.title
}
}
},
}
const actions = {
//动态改变tab 页签(上方还有代码) 调用debug/debugData/calibrationRecord.vue
// this.$route.meta.title = reportName
// this.$store.dispatch('tagsView/editVisitedViews', this.$route)
editVisitedViews({ commit, state }, view) {
return new Promise((resolve) => {
commit('EDIT_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
},
}
//页面中调用
this.$route.meta.title = '随机名字'
this.$store.dispatch('tagsView/editVisitedViews', this.$route)
更多推荐
已为社区贡献2条内容
所有评论(0)