Selaa lähdekoodia

docs: update README.md

fix: fix useScrollTo not work bug

feat: add doucment link
陈凯龙 3 vuotta sitten
vanhempi
säilyke
53201ae97a

+ 2 - 1
README.md

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

+ 2 - 1
README.zh-CN.md

@@ -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**
 
@@ -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)
 
 ## 前序准备
 

+ 18 - 0
mock/role/index.ts

@@ -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: '#',
@@ -414,6 +430,8 @@ const testList: string[] = [
   '/dashboard',
   '/dashboard/analysis',
   '/dashboard/workplace',
+  'external-link',
+  'https://element-plus-admin-doc.cn/',
   '/guide',
   '/guide/index',
   '/components',

+ 1 - 0
src/components/Menu/src/Menu.vue

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

+ 0 - 1
src/components/Menu/src/components/useRenderMenuItem.tsx

@@ -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('/')

+ 5 - 0
src/components/TabMenu/src/TabMenu.vue

@@ -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()
 
@@ -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)

+ 9 - 1
src/components/UserInfo/src/UserInfo.vue

@@ -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()
 
@@ -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>
@@ -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>

+ 2 - 1
src/locales/en.ts

@@ -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',

+ 2 - 1
src/locales/zh-CN.ts

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

+ 16 - 0
src/router/index.ts

@@ -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,

+ 1 - 0
src/utils/routerHelper.ts

@@ -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, '/')
 }