修复HeaderSearch组件跳转query参数丢失问题
| | |
| | | }
|
| | | function change(val) {
|
| | | const path = val.path;
|
| | | const query = val.query;
|
| | | if (isHttp(path)) {
|
| | | // http(s):// 路径新窗口打开
|
| | | const pindex = path.indexOf("http");
|
| | | window.open(path.substr(pindex, path.length), "_blank");
|
| | | } else {
|
| | | router.push(path)
|
| | | if (query) {
|
| | | router.push({ path: path, query: JSON.parse(query) });
|
| | | } else {
|
| | | router.push(path)
|
| | | }
|
| | | }
|
| | |
|
| | | search.value = ''
|
| | |
| | | }
|
| | | // Filter out the routes that can be displayed in the sidebar
|
| | | // And generate the internationalized title
|
| | | function generateRoutes(routes, basePath = '', prefixTitle = []) {
|
| | | function generateRoutes(routes, basePath = '', prefixTitle = [], query = {}) {
|
| | | let res = []
|
| | |
|
| | | for (const r of routes) {
|
| | |
| | | res.push(data)
|
| | | }
|
| | | }
|
| | | if (r.query) {
|
| | | data.query = r.query
|
| | | }
|
| | |
|
| | | // recursive child routes
|
| | | 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) {
|
| | | res = [...res, ...tempRoutes]
|
| | | }
|