docs: update README.md

fix: fix useScrollTo not work bug

feat: add doucment link
This commit is contained in:
陈凯龙 2022-02-22 11:27:29 +08:00
parent be94a09f4c
commit 53201ae97a
11 changed files with 58 additions and 6 deletions

View File

@ -29,6 +29,7 @@ If you need a basic template, please switch to the `tempalte` branch. `Tempalte`
## Preview ## Preview
- [vue-element-plus-admin](https://element-plus-admin.cn/) - Full version of the github site - [vue-element-plus-admin](https://element-plus-admin.cn/) - Full version of the github site
- [vue-element-plus-admin](https://kailong110120130.gitee.io/vue-element-plus-admin) - Full version of the gitee site
account: **admin/admin test/test** account: **admin/admin test/test**
@ -38,7 +39,7 @@ account: **admin/admin test/test**
## Documentation ## Documentation
[Document](https://element-plus-admin.cn/) [Document Github](https://element-plus-admin.cn/) [Document Gitee](https://kailong110120130.gitee.io/vue-element-plus-admin-doc)
## Preparation ## Preparation

View File

@ -29,6 +29,7 @@ vue-element-plus-admin 的定位是后台集成方案,不太适合当基础模
## 预览 ## 预览
- [vue-element-plus-admin](https://element-plus-admin.cn/) - 完整版 github 站点 - [vue-element-plus-admin](https://element-plus-admin.cn/) - 完整版 github 站点
- [vue-element-plus-admin](https://kailong110120130.gitee.io/vue-element-plus-admin) - 完整版 gitee 站点
帐号:**admin/admin test/test** 帐号:**admin/admin test/test**
@ -38,7 +39,7 @@ vue-element-plus-admin 的定位是后台集成方案,不太适合当基础模
## 文档 ## 文档
[文档地址](https://element-plus-admin-doc.cn/) [文档地址 Github](https://element-plus-admin-doc.cn/) [文档地址 Gitee](https://kailong110120130.gitee.io/vue-element-plus-admin-doc)
## 前序准备 ## 前序准备

View File

@ -37,6 +37,22 @@ const adminList = [
} }
] ]
}, },
{
path: '/external-link',
component: '#',
meta: {},
name: 'ExternalLink',
children: [
{
path: 'https://element-plus-admin-doc.cn/',
name: 'DocumentLink',
meta: {
title: 'router.document',
icon: 'clarity:document-solid'
}
}
]
},
{ {
path: '/guide', path: '/guide',
component: '#', component: '#',
@ -414,6 +430,8 @@ const testList: string[] = [
'/dashboard', '/dashboard',
'/dashboard/analysis', '/dashboard/analysis',
'/dashboard/workplace', '/dashboard/workplace',
'external-link',
'https://element-plus-admin-doc.cn/',
'/guide', '/guide',
'/guide/index', '/guide/index',
'/components', '/components',

View File

@ -61,6 +61,7 @@ export default defineComponent({
props.menuSelect(index) props.menuSelect(index)
} }
// //
console.log(index)
if (isUrl(index)) { if (isUrl(index)) {
window.open(index) window.open(index)
} else { } else {

View File

@ -15,7 +15,6 @@ export const useRenderMenuItem = (
const meta = (v.meta ?? {}) as RouteMeta const meta = (v.meta ?? {}) as RouteMeta
if (!meta.hidden) { if (!meta.hidden) {
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
const fullPath = isUrl(v.path) const fullPath = isUrl(v.path)
? v.path ? v.path
: getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/') : getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')

View File

@ -11,6 +11,7 @@ import { pathResolve } from '@/utils/routerHelper'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { filterMenusPath, initTabMap, tabPathMap } from './helper' import { filterMenusPath, initTabMap, tabPathMap } from './helper'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'
import { isUrl } from '@/utils/is'
const { getPrefixCls, variables } = useDesign() const { getPrefixCls, variables } = useDesign()
@ -72,6 +73,10 @@ export default defineComponent({
// tab // tab
const tabClick = (item: AppRouteRecordRaw) => { const tabClick = (item: AppRouteRecordRaw) => {
if (isUrl(item.path)) {
window.open(item.path)
return
}
tabActive.value = item.children ? item.path : item.path.split('/')[0] tabActive.value = item.children ? item.path : item.path.split('/')[0]
if (item.children) { if (item.children) {
showMenu.value = !unref(showMenu) showMenu.value = !unref(showMenu)

View File

@ -6,6 +6,9 @@ import { resetRouter } from '@/router'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { loginOutApi } from '@/api/login' import { loginOutApi } from '@/api/login'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'
import { useTagsViewStore } from '@/store/modules/tagsView'
const tagsViewStore = useTagsViewStore()
const { getPrefixCls } = useDesign() const { getPrefixCls } = useDesign()
@ -27,12 +30,17 @@ const loginOut = () => {
const res = await loginOutApi().catch(() => {}) const res = await loginOutApi().catch(() => {})
if (res) { if (res) {
wsCache.clear() wsCache.clear()
tagsViewStore.delAllViews()
resetRouter() // resetRouter() //
replace('/login') replace('/login')
} }
}) })
.catch(() => {}) .catch(() => {})
} }
const toDocument = () => {
window.open('https://element-plus-admin-doc.cn/')
}
</script> </script>
<template> <template>
@ -48,7 +56,7 @@ const loginOut = () => {
<template #dropdown> <template #dropdown>
<ElDropdownMenu> <ElDropdownMenu>
<ElDropdownItem> <ElDropdownItem>
<div>{{ t('common.document') }}</div> <div @click="toDocument">{{ t('common.document') }}</div>
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem divided> <ElDropdownItem divided>
<div @click="loginOut">{{ t('common.loginOut') }}</div> <div @click="loginOut">{{ t('common.loginOut') }}</div>

View File

@ -129,7 +129,8 @@ export default {
errorPage: 'Error page', errorPage: 'Error page',
authorization: 'Authorization', authorization: 'Authorization',
user: 'User management', user: 'User management',
role: 'Role management' role: 'Role management',
document: 'Document'
}, },
analysis: { analysis: {
newUser: 'New user', newUser: 'New user',

View File

@ -129,7 +129,8 @@ export default {
errorPage: '错误页面', errorPage: '错误页面',
authorization: '权限管理', authorization: '权限管理',
user: '用户管理', user: '用户管理',
role: '角色管理' role: '角色管理',
document: '文档'
}, },
analysis: { analysis: {
newUser: '新增用户', newUser: '新增用户',

View File

@ -87,6 +87,22 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
} }
] ]
}, },
{
path: '/external-link',
component: Layout,
meta: {},
name: 'ExternalLink',
children: [
{
path: 'https://element-plus-admin-doc.cn/',
name: 'DocumentLink',
meta: {
title: t('router.document'),
icon: 'clarity:document-solid'
}
}
]
},
{ {
path: '/guide', path: '/guide',
component: Layout, component: Layout,

View File

@ -114,6 +114,7 @@ export const generateRoutesFn2 = (routes: AppCustomRouteRecordRaw[]): AppRouteRe
} }
export const pathResolve = (parentPath: string, path: string) => { export const pathResolve = (parentPath: string, path: string) => {
if (isUrl(path)) return path
const childPath = path.startsWith('/') || !path ? path : `/${path}` const childPath = path.startsWith('/') || !path ? path : `/${path}`
return `${parentPath}${childPath}`.replace(/\/\//g, '/') return `${parentPath}${childPath}`.replace(/\/\//g, '/')
} }