From f76b122a386d592244eab7721c5b31c5e4bcf08a Mon Sep 17 00:00:00 2001
From: chuan_wuhao <443547225@qq.com>
Date: Thu, 29 Dec 2022 14:58:55 +0800
Subject: [PATCH] =?UTF-8?q?v3.0.2=E5=8F=91=E5=B8=83=EF=BC=8C=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=E6=96=87=E6=A1=A3=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=80?=
=?UTF-8?q?=E4=BA=9B=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
locales/en-US.json | 3 ++-
locales/zh-CN.json | 3 ++-
package.json | 2 +-
src/icons/doc.svg | 13 +++++++++++++
src/router/modules/doc.ts | 10 ++++++++++
src/router/modules/index.ts | 3 ++-
src/store/modules/menu.ts | 16 +++++++++++-----
src/views/doc/index.tsx | 20 ++++++++++++++++++++
src/vite-env.d.ts | 1 +
9 files changed, 62 insertions(+), 9 deletions(-)
create mode 100644 src/icons/doc.svg
create mode 100644 src/router/modules/doc.ts
create mode 100644 src/views/doc/index.tsx
diff --git a/locales/en-US.json b/locales/en-US.json
index 8d8c5bfe..67dc5f0a 100644
--- a/locales/en-US.json
+++ b/locales/en-US.json
@@ -7,7 +7,8 @@
"Echart": "Chart",
"scrollReveal": "Scroll Reveal",
"Axios": "Axios Request",
- "Table": "Table"
+ "Table": "Table",
+ "Doc": "Doc"
},
"LayoutHeaderTooltipOptions": {
"Reload": "Reload Current Page",
diff --git a/locales/zh-CN.json b/locales/zh-CN.json
index 6a68e52c..da21468e 100644
--- a/locales/zh-CN.json
+++ b/locales/zh-CN.json
@@ -7,7 +7,8 @@
"Echart": "可视化",
"scrollReveal": "滚动动画",
"Axios": "请求",
- "Table": "表格"
+ "Table": "表格",
+ "Doc": "文档"
},
"LayoutHeaderTooltipOptions": {
"Reload": "刷新当前页面",
diff --git a/package.json b/package.json
index 225045cb..59ef324d 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ray-template",
"private": true,
- "version": "3.0.1",
+ "version": "3.0.2",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/icons/doc.svg b/src/icons/doc.svg
new file mode 100644
index 00000000..6b7be9ee
--- /dev/null
+++ b/src/icons/doc.svg
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/src/router/modules/doc.ts b/src/router/modules/doc.ts
new file mode 100644
index 00000000..b073d811
--- /dev/null
+++ b/src/router/modules/doc.ts
@@ -0,0 +1,10 @@
+export default {
+ path: '/doc',
+ name: 'doc',
+ component: () => import('@/views/doc/index'),
+ meta: {
+ i18nKey: 'Doc',
+ icon: 'doc',
+ windowOpen: 'https://xiaodaigua-ray.github.io/ray-template-doc/',
+ },
+}
diff --git a/src/router/modules/index.ts b/src/router/modules/index.ts
index 64479d2c..c96e48ec 100644
--- a/src/router/modules/index.ts
+++ b/src/router/modules/index.ts
@@ -5,8 +5,9 @@ import echart from './echart'
import scrollReveal from './scroll-reveal'
import axios from './axios'
import table from './table'
+import doc from './doc'
-const routes = [dashboard, echart, table, axios, scrollReveal, error, reyl]
+const routes = [dashboard, echart, table, axios, scrollReveal, error, doc, reyl]
export default routes
diff --git a/src/store/modules/menu.ts b/src/store/modules/menu.ts
index 45b6c204..2c67a91c 100644
--- a/src/store/modules/menu.ts
+++ b/src/store/modules/menu.ts
@@ -3,7 +3,7 @@ import { NEllipsis } from 'naive-ui'
import RayIcon from '@/components/RayIcon/index'
import type { MenuOption } from 'naive-ui'
-import type { RouteRecordRaw } from 'vue-router'
+import type { RouteRecordRaw, RouteMeta } from 'vue-router'
export const useMenu = defineStore('menu', () => {
const router = useRouter()
@@ -40,12 +40,18 @@ export const useMenu = defineStore('menu', () => {
* 修改 `menu key` 后的回调函数
*/
const menuModelValueChange = (key: string, item: MenuOption) => {
- handleMenuTagOptions(item as unknown as TagMenuOptions)
+ const meta = item.meta as RouteMeta
- menuState.menuKey = key
+ if (meta.windowOpen) {
+ window.open(meta.windowOpen)
+ } else {
+ handleMenuTagOptions(item as unknown as TagMenuOptions)
- router.push(`${item.path}`)
- setCache('menuKey', key)
+ menuState.menuKey = key
+
+ router.push(`${item.path}`)
+ setCache('menuKey', key)
+ }
}
/**
diff --git a/src/views/doc/index.tsx b/src/views/doc/index.tsx
new file mode 100644
index 00000000..bfb8624b
--- /dev/null
+++ b/src/views/doc/index.tsx
@@ -0,0 +1,20 @@
+/**
+ *
+ * @author Ray
+ *
+ * @date 2022-12-29
+ *
+ * @workspace ray-template
+ *
+ * @remark 今天也是元气满满撸代码的一天
+ */
+
+const RayTemplateDoc = defineComponent({
+ name: 'RayTemplateDoc',
+ // setup() {},
+ render() {
+ return
+ },
+})
+
+export default RayTemplateDoc
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 5c45f307..0036831b 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -14,6 +14,7 @@ declare module 'vue-router' {
interface RouteMeta {
i18nKey: string
icon?: string
+ windowOpen?: string
}
}