基本完成

Former-commit-id: 4d9b039cac8205ae66e7c0189ba6c8ca0ee69068 [formerly 4d9b039cac8205ae66e7c0189ba6c8ca0ee69068 [formerly 4d9b039cac8205ae66e7c0189ba6c8ca0ee69068 [formerly 4d9b039cac8205ae66e7c0189ba6c8ca0ee69068 [formerly ef07da1feaee3062a8b597c01abe8676ec8fee1f [formerly 735ab19a7fa3c151c317952e38198c5803cdacad]]]]]
Former-commit-id: 5ad5a87bb45c1a1ed8b63d80cf868339daceb31f
Former-commit-id: 02ddcd34082c40f2e09ea08666912f8d6eb3fb65
Former-commit-id: 0b4940b7b5f60f5835f325da20923fb1caea05cf [formerly 47e09c5d46868279df43ca2a3d4fbdb6bbcd38ac]
Former-commit-id: 9ac892cf0a29999a8560e45bd7a954f581efe1f8
Former-commit-id: a025b38832a9b326893545b422a7dea653c99f31
Former-commit-id: 4ce579cc6ca5cfd91ad3d1a25b59e74992256a3b
Former-commit-id: 01eb489103d67ddabc90d711c42a3ccd39572e40
Former-commit-id: 8840285fb15925b1715f0983bb03119c8c0022d3
This commit is contained in:
liyang
2018-08-28 17:00:09 +08:00
parent 34d2191bbc
commit 61cffc8e43
6 changed files with 208 additions and 12 deletions

View File

@@ -5,10 +5,13 @@ export default {
state: {
// 搜索面板激活状态
active: true,
// 快捷键
hotkey: {
open: setting.hotkey.search.open,
close: setting.hotkey.search.close
}
},
// 所有可以搜索的页面
pool: []
},
mutations: {
/**
@@ -25,6 +28,28 @@ export default {
*/
set (state, active) {
state.active = active
},
/**
* @description 初始化
* @param {Object} state vuex state
* @param {Array} menus menus
*/
init (state, menus) {
const pool = []
const push = function (menus, titlePrefix = []) {
menus.forEach(menu => {
if (menu.children) {
push(menu.children, [ ...titlePrefix, menu.title ])
} else {
pool.push({
...menu,
fullTitle: [ ...titlePrefix, menu.title ].join(' / ')
})
}
})
}
push(menus)
state.pool = pool
}
}
}