Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
fix: fix useScrollTo not work bug

feat: add doucment link
  • Loading branch information
kailong502431556 committed Feb 22, 2022
1 parent be94a09 commit 53201ae
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ If you need a basic template, please switch to the `tempalte` branch. `Tempalte`
## Preview

- [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**

Expand All @@ -38,7 +39,7 @@ account: **admin/admin test/test**

## 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

Expand Down
3 changes: 2 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ vue-element-plus-admin 的定位是后台集成方案,不太适合当基础模
## 预览

- [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**

Expand All @@ -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)

## 前序准备

Expand Down
18 changes: 18 additions & 0 deletions mock/role/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
component: '#',
Expand Down Expand Up @@ -414,6 +430,8 @@ const testList: string[] = [
'/dashboard',
'/dashboard/analysis',
'/dashboard/workplace',
'external-link',
'https://element-plus-admin-doc.cn/',
'/guide',
'/guide/index',
'/components',
Expand Down
1 change: 1 addition & 0 deletions src/components/Menu/src/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default defineComponent({
props.menuSelect(index)
}
// 自定义事件
console.log(index)
if (isUrl(index)) {
window.open(index)
} else {
Expand Down
1 change: 0 additions & 1 deletion src/components/Menu/src/components/useRenderMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const useRenderMenuItem = (
const meta = (v.meta ?? {}) as RouteMeta
if (!meta.hidden) {
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)

const fullPath = isUrl(v.path)
? v.path
: getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
Expand Down
5 changes: 5 additions & 0 deletions src/components/TabMenu/src/TabMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { pathResolve } from '@/utils/routerHelper'
import { cloneDeep } from 'lodash-es'
import { filterMenusPath, initTabMap, tabPathMap } from './helper'
import { useDesign } from '@/hooks/web/useDesign'
import { isUrl } from '@/utils/is'
const { getPrefixCls, variables } = useDesign()
Expand Down Expand Up @@ -72,6 +73,10 @@ export default defineComponent({
// tab点击事件
const tabClick = (item: AppRouteRecordRaw) => {
if (isUrl(item.path)) {
window.open(item.path)
return
}
tabActive.value = item.children ? item.path : item.path.split('/')[0]
if (item.children) {
showMenu.value = !unref(showMenu)
Expand Down
10 changes: 9 additions & 1 deletion src/components/UserInfo/src/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { resetRouter } from '@/router'
import { useRouter } from 'vue-router'
import { loginOutApi } from '@/api/login'
import { useDesign } from '@/hooks/web/useDesign'
import { useTagsViewStore } from '@/store/modules/tagsView'
const tagsViewStore = useTagsViewStore()
const { getPrefixCls } = useDesign()
Expand All @@ -27,12 +30,17 @@ const loginOut = () => {
const res = await loginOutApi().catch(() => {})
if (res) {
wsCache.clear()
tagsViewStore.delAllViews()
resetRouter() // 重置静态路由表
replace('/login')
}
})
.catch(() => {})
}
const toDocument = () => {
window.open('https://element-plus-admin-doc.cn/')
}
</script>

<template>
Expand All @@ -48,7 +56,7 @@ const loginOut = () => {
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem>
<div>{{ t('common.document') }}</div>
<div @click="toDocument">{{ t('common.document') }}</div>
</ElDropdownItem>
<ElDropdownItem divided>
<div @click="loginOut">{{ t('common.loginOut') }}</div>
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export default {
errorPage: 'Error page',
authorization: 'Authorization',
user: 'User management',
role: 'Role management'
role: 'Role management',
document: 'Document'
},
analysis: {
newUser: 'New user',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export default {
errorPage: '错误页面',
authorization: '权限管理',
user: '用户管理',
role: '角色管理'
role: '角色管理',
document: '文档'
},
analysis: {
newUser: '新增用户',
Expand Down
16 changes: 16 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
component: Layout,
Expand Down
1 change: 1 addition & 0 deletions src/utils/routerHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const generateRoutesFn2 = (routes: AppCustomRouteRecordRaw[]): AppRouteRe
}

export const pathResolve = (parentPath: string, path: string) => {
if (isUrl(path)) return path
const childPath = path.startsWith('/') || !path ? path : `/${path}`
return `${parentPath}${childPath}`.replace(/\/\//g, '/')
}
Expand Down

0 comments on commit 53201ae

Please sign in to comment.