feat(Menu.vue): 菜单路由添加外链支持
This commit is contained in:
@@ -44,6 +44,17 @@ export const constantRoutes: Array<RouteRecordRaw> = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
// 外部链接
|
||||||
|
/*{
|
||||||
|
path: '/external-link',
|
||||||
|
component: Layout,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'https://www.cnblogs.com/haoxianrui/',
|
||||||
|
meta: { title: '外部链接', icon: 'link' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}*/
|
||||||
// 多级嵌套路由
|
// 多级嵌套路由
|
||||||
/* {
|
/* {
|
||||||
path: '/nested',
|
path: '/nested',
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
export function isExternal(path : string) {
|
export function isExternal(path: string) {
|
||||||
return /^(https?:|mailto:|tel:)/.test(path)
|
const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path)
|
||||||
|
return isExternal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,10 +104,20 @@
|
|||||||
<el-input v-model="formData.name" placeholder="请输入菜单名称"/>
|
<el-input v-model="formData.name" placeholder="请输入菜单名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="页面路径" prop="component">
|
<el-form-item label="是否外链" >
|
||||||
|
<el-radio-group v-model="isExternal">
|
||||||
|
<el-radio :label="false">否</el-radio>
|
||||||
|
<el-radio :label="true">是</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="isExternal" label="外链地址" prop="path">
|
||||||
|
<el-input v-model="formData.path" placeholder="请输入外链完整路径"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item v-if="!isExternal" label="页面路径" prop="component">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.component"
|
v-model="formData.component"
|
||||||
:readonly="formData.parentId==0?true:false"
|
|
||||||
placeholder="system/user/index"
|
placeholder="system/user/index"
|
||||||
style="width: 95%"
|
style="width: 95%"
|
||||||
>
|
>
|
||||||
@@ -116,7 +126,7 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-tooltip effect="dark"
|
<el-tooltip effect="dark"
|
||||||
content="请输入页面路径,如果是父级菜单请填写 Layout 即可"
|
content="请输入组件路径,如果是父组件填写 Layout 即可"
|
||||||
placement="right">
|
placement="right">
|
||||||
<i class="el-icon-info" style="margin-left: 10px;color:darkseagreen"></i>
|
<i class="el-icon-info" style="margin-left: 10px;color:darkseagreen"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -232,10 +242,11 @@ const state = reactive({
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
menuOptions: [] as any[],
|
menuOptions: [] as any[],
|
||||||
currentRow: undefined
|
currentRow: undefined,
|
||||||
|
isExternal: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const {loading, single, multiple, queryParams, menuList, total, dialog, formData, rules, menuOptions} = toRefs(state)
|
const {loading, single, multiple, queryParams, menuList, total, dialog, formData, rules, menuOptions,isExternal} = toRefs(state)
|
||||||
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
// 重置父组件
|
// 重置父组件
|
||||||
|
|||||||
Reference in New Issue
Block a user