feat: add function of link for out website in menu; :star: #135
新增:菜单增加外链功能;
| | |
| | | return !icon || icon == 'none' ? null : h(Icon, {props: {type: icon}}) |
| | | }, |
| | | renderMenuItem: function (h, menu) { |
| | | let tag = 'router-link' |
| | | let config = {props: {to: menu.fullPath}, attrs: {style: 'overflow:hidden;white-space:normal;text-overflow:clip;'}} |
| | | if (menu.meta && menu.meta.link) { |
| | | tag = 'a' |
| | | config = {attrs: {style: 'overflow:hidden;white-space:normal;text-overflow:clip;', href: menu.meta.link, target: '_blank'}} |
| | | } |
| | | return h( |
| | | Item, {key: menu.fullPath}, |
| | | [ |
| | | h('router-link', {props: {to: menu.fullPath}, attrs: {style: 'overflow:hidden;white-space:normal;text-overflow:clip;'}}, |
| | | h(tag, config, |
| | | [ |
| | | this.renderIcon(h, menu.meta ? menu.meta.icon : 'none', menu.fullPath), |
| | | this.$t(getI18nKey(menu.fullPath)) |
| | |
| | | router: 'basicForm', |
| | | name: '验权表单', |
| | | icon: 'file-excel', |
| | | authority: 'form' |
| | | authority: 'queryForm' |
| | | }, |
| | | { |
| | | router: 'antdv', |
| | | path: 'antdv', |
| | | name: 'Ant Design Vue', |
| | | icon: 'ant-design', |
| | | link: 'https://www.antdv.com/docs/vue/introduce-cn/' |
| | | }, |
| | | { |
| | | router: 'document', |
| | | path: 'document', |
| | | name: '使用文档', |
| | | icon: 'file-word', |
| | | link: 'https://iczer.gitee.io/vue-antd-admin-docs/' |
| | | } |
| | | ] |
| | | }] |
| | |
| | | } |
| | | }, |
| | | component: () => import('@/pages/form/basic') |
| | | }, |
| | | { |
| | | name: 'Ant Design Vue', |
| | | path: 'antdv', |
| | | meta: { |
| | | icon: 'ant-design', |
| | | link: 'https://www.antdv.com/docs/vue/introduce-cn/' |
| | | } |
| | | }, |
| | | { |
| | | name: '使用文档', |
| | | path: 'document', |
| | | meta: { |
| | | icon: 'file-word', |
| | | link: 'https://iczer.gitee.io/vue-antd-admin-docs/' |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | |
| | | router = routerMap[item.router] |
| | | routeCfg = item |
| | | } |
| | | // 从 router 和 routeCfg 解析路由 |
| | | if (!router) { |
| | | console.warn(`can't find register for router ${routeCfg.router}, please register it in advance.`) |
| | | } else { |
| | | const route = { |
| | | path: routeCfg.path || router.path || routeCfg.router, |
| | | name: routeCfg.name || router.name, |
| | | component: router.component, |
| | | redirect: routeCfg.redirect || router.redirect, |
| | | meta: { |
| | | authority: routeCfg.authority || router.authority || '*', |
| | | icon: routeCfg.icon || router.icon, |
| | | page: routeCfg.page || router.page |
| | | } |
| | | } |
| | | if (routeCfg.invisible || router.invisible) { |
| | | route.meta.invisible = true |
| | | } |
| | | if (routeCfg.children && routeCfg.children.length > 0) { |
| | | route.children = parseRoutes(routeCfg.children, routerMap) |
| | | } |
| | | routes.push(route) |
| | | router = typeof item === 'string' ? {path: item, name: item} : item |
| | | } |
| | | // 从 router 和 routeCfg 解析路由 |
| | | const route = { |
| | | path: routeCfg.path || router.path || routeCfg.router, |
| | | name: routeCfg.name || router.name, |
| | | component: router.component, |
| | | redirect: routeCfg.redirect || router.redirect, |
| | | meta: { |
| | | authority: routeCfg.authority || router.authority || '*', |
| | | icon: routeCfg.icon || router.icon, |
| | | page: routeCfg.page || router.page, |
| | | link: routeCfg.link || router.link |
| | | } |
| | | } |
| | | if (routeCfg.invisible || router.invisible) { |
| | | route.meta.invisible = true |
| | | } |
| | | if (routeCfg.children && routeCfg.children.length > 0) { |
| | | route.children = parseRoutes(routeCfg.children, routerMap) |
| | | } |
| | | routes.push(route) |
| | | }) |
| | | return routes |
| | | } |
| | |
| | | * @param routesConfig {RouteConfig[]} 路由配置 |
| | | */ |
| | | function loadRoutes(routesConfig) { |
| | | console.log('hahah') |
| | | //兼容 0.6.1 以下版本 |
| | | /*************** 兼容 version < v0.6.1 *****************/ |
| | | if (arguments.length > 0) { |