no message
Former-commit-id: ba34ab8a9fcbf1cfffc54111935891e6a6024baf [formerly ba34ab8a9fcbf1cfffc54111935891e6a6024baf [formerly ba34ab8a9fcbf1cfffc54111935891e6a6024baf [formerly ba34ab8a9fcbf1cfffc54111935891e6a6024baf [formerly 468305dfd82cd0ecf96f389c4648f002b3643f82 [formerly ae318aa6d1de0726925f15fe875f426445992187]]]]] Former-commit-id: 6763abcd19d399bf9b417d38dc52dbf8bde2fc0d Former-commit-id: 4c4a492af4e5b79b7129e914a96e842002d41721 Former-commit-id: 98fca5903e7e9abd28a7550ea094e2b94e2516ed [formerly 2a760a5ac7367e13d67366cd2bb7eefeeac271c7] Former-commit-id: f6ba6535da660173ac05084f48faea15bdaf257c Former-commit-id: db879446f9631e92e66f807c767846a9b718f13e Former-commit-id: 56bea6996c90fee92cdc7badd4eef9a0e123b3f2 Former-commit-id: 07fea45f363b647c1f1969e1bc4e0b625203890c Former-commit-id: dc3d71de8749f0eb6484b56866f45f15648a35c9
This commit is contained in:
@@ -5,7 +5,8 @@ const adapter = new LocalStorage('d2admin')
|
||||
const db = low(adapter)
|
||||
|
||||
db.defaults({
|
||||
themeActive: []
|
||||
themeActive: [],
|
||||
pageOpenedList: []
|
||||
})
|
||||
.write()
|
||||
|
||||
|
||||
@@ -40,4 +40,41 @@ util.exitFullScreen = function () {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在每次打开新页面的时候调用 打开一个新的 tab
|
||||
* @param {object} vm vue
|
||||
* @param {string} name route name
|
||||
* @param {object} argu arguments
|
||||
* @param {object} query query object
|
||||
*/
|
||||
util.openNewPage = function (vm, name, argu, query) {
|
||||
// 已经打开的页面
|
||||
let pageOpenedList = vm.$store.state.d2admin.pageOpenedList
|
||||
// 判断此页面是否已经打开 并且记录位置
|
||||
let pageOpendIndex = 0
|
||||
const pageOpend = pageOpenedList.find((page, index) => {
|
||||
const same = page.name === name
|
||||
pageOpendIndex = same ? index : pageOpendIndex
|
||||
return same
|
||||
})
|
||||
if (pageOpend) {
|
||||
// 页面以前打开过
|
||||
console.group('page opend')
|
||||
console.log('pageOpendIndex: ', pageOpendIndex)
|
||||
console.groupEnd()
|
||||
// 虽然页面以前打开过
|
||||
// 但是新的页面可能 name 一样,参数不一样
|
||||
vm.$store.commit('d2adminpageOpenedListUpdateItem', {
|
||||
index: pageOpendIndex,
|
||||
argu: argu,
|
||||
query: query
|
||||
})
|
||||
} else {
|
||||
// 页面以前没有打开过
|
||||
console.group('page not opend')
|
||||
console.log('pageOpendIndex: ', pageOpendIndex)
|
||||
console.groupEnd()
|
||||
}
|
||||
}
|
||||
|
||||
export default util
|
||||
|
||||
Reference in New Issue
Block a user