增加修改标签标题的方法

This commit is contained in:
王珏 2020-08-26 10:25:54 +08:00
parent c9da05eb8f
commit 3e496015f5
1 changed files with 15 additions and 0 deletions

View File

@ -214,6 +214,21 @@ export default {
await router.push(routerObj)
}
},
/**
* @class opened
* @description 关闭一个 tag (关闭一个页面)
* @param {Object} context
* @param {Object} payload { tagName: 要更新的标签名字, title: 新的标签名字 }
*/
update ({ state }, { tagName, title }) {
const index = state.opened.findIndex(page => page.fullPath === tagName)
if (index === 0) {
return
}
if (title && state.opened[index]) {
state.opened[index].meta.title = title
}
},
/**
* @class opened
* @description 关闭当前标签左边的标签