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,7 @@
|
|||||||
type="card"
|
type="card"
|
||||||
@tab-click="handleClick">
|
@tab-click="handleClick">
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="(page, index) in pageList"
|
v-for="(page, index) in pageOpenedList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="page.title"
|
:label="page.title"
|
||||||
:name="page.name">
|
:name="page.name">
|
||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
pageList: state => state.d2admin.pageList
|
pageOpenedList: state => state.d2admin.pageOpenedList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ const adapter = new LocalStorage('d2admin')
|
|||||||
const db = low(adapter)
|
const db = low(adapter)
|
||||||
|
|
||||||
db.defaults({
|
db.defaults({
|
||||||
themeActive: []
|
themeActive: [],
|
||||||
|
pageOpenedList: []
|
||||||
})
|
})
|
||||||
.write()
|
.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
|
export default util
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
b6ab24082bf827aca85248d9163c9ecb8b23de1d
|
0088ad6cc03c64af08ec7f8e7e691d0fec144c65
|
||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
themeList,
|
themeList,
|
||||||
themeActive: themeList[1],
|
themeActive: themeList[1],
|
||||||
// 多页
|
// 多页
|
||||||
pageList: [
|
pageOpenedList: [
|
||||||
{
|
{
|
||||||
name: 'index',
|
name: 'index',
|
||||||
title: '首页'
|
title: '首页'
|
||||||
@@ -20,6 +20,34 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
/**
|
||||||
|
* 更新页面列表上的某一项
|
||||||
|
* @param {state} state vuex state
|
||||||
|
* @param {info} param1 new page info
|
||||||
|
*/
|
||||||
|
d2adminpageOpenedListUpdateItem (state, { index, argu, query }) {
|
||||||
|
// dev
|
||||||
|
console.group('d2adminpageOpenedListUpdateItem')
|
||||||
|
console.log('index: ', index)
|
||||||
|
console.log('argu: ', argu)
|
||||||
|
console.log('query: ', query)
|
||||||
|
console.groupEnd()
|
||||||
|
// 更新页面列表某一项
|
||||||
|
let page = state.pageOpenedList[index]
|
||||||
|
page.argu = argu || page.argu
|
||||||
|
page.query = query || page.query
|
||||||
|
state.pageOpenedList.splice(index, 1, page)
|
||||||
|
// 更新设置到数据库
|
||||||
|
const setting = db.get('pageOpenedList').find({uuid: util.uuid()})
|
||||||
|
if (setting.value()) {
|
||||||
|
setting.assign({value: state.pageOpenedList}).write()
|
||||||
|
} else {
|
||||||
|
db.get('pageOpenedList').push({
|
||||||
|
uuid: util.uuid(),
|
||||||
|
value: state.pageOpenedList
|
||||||
|
}).write()
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 切换全屏
|
* 切换全屏
|
||||||
* @param {state} state vuex state
|
* @param {state} state vuex state
|
||||||
|
|||||||
Reference in New Issue
Block a user