|
|
@ -45,12 +45,17 @@ function close() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function change(val) {
|
|
|
|
function change(val) {
|
|
|
|
const path = val.path;
|
|
|
|
const path = val.path;
|
|
|
|
|
|
|
|
const query = val.query;
|
|
|
|
if (isHttp(path)) {
|
|
|
|
if (isHttp(path)) {
|
|
|
|
// http(s):// 路径新窗口打开
|
|
|
|
// http(s):// 路径新窗口打开
|
|
|
|
const pindex = path.indexOf("http");
|
|
|
|
const pindex = path.indexOf("http");
|
|
|
|
window.open(path.substr(pindex, path.length), "_blank");
|
|
|
|
window.open(path.substr(pindex, path.length), "_blank");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
router.push(path)
|
|
|
|
if (query) {
|
|
|
|
|
|
|
|
router.push({ path: path, query: JSON.parse(query) });
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
router.push(path)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
search.value = ''
|
|
|
|
search.value = ''
|
|
|
@ -77,7 +82,7 @@ function initFuse(list) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Filter out the routes that can be displayed in the sidebar
|
|
|
|
// Filter out the routes that can be displayed in the sidebar
|
|
|
|
// And generate the internationalized title
|
|
|
|
// And generate the internationalized title
|
|
|
|
function generateRoutes(routes, basePath = '', prefixTitle = []) {
|
|
|
|
function generateRoutes(routes, basePath = '', prefixTitle = [], query = {}) {
|
|
|
|
let res = []
|
|
|
|
let res = []
|
|
|
|
|
|
|
|
|
|
|
|
for (const r of routes) {
|
|
|
|
for (const r of routes) {
|
|
|
@ -98,10 +103,13 @@ function generateRoutes(routes, basePath = '', prefixTitle = []) {
|
|
|
|
res.push(data)
|
|
|
|
res.push(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r.query) {
|
|
|
|
|
|
|
|
data.query = r.query
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// recursive child routes
|
|
|
|
// recursive child routes
|
|
|
|
if (r.children) {
|
|
|
|
if (r.children) {
|
|
|
|
const tempRoutes = generateRoutes(r.children, data.path, data.title)
|
|
|
|
const tempRoutes = generateRoutes(r.children, data.path, data.title, data.query)
|
|
|
|
if (tempRoutes.length >= 1) {
|
|
|
|
if (tempRoutes.length >= 1) {
|
|
|
|
res = [...res, ...tempRoutes]
|
|
|
|
res = [...res, ...tempRoutes]
|
|
|
|
}
|
|
|
|
}
|
|
|
|