From 7206c1712f2baa77a884a0e91ce3f7562267507f Mon Sep 17 00:00:00 2001 From: wangdan Date: Thu, 10 Aug 2023 15:40:49 +0800 Subject: [PATCH] feat: --- .gitignore | 1 + src/components/dataease-tabs/index.vue | 185 + src/router/index.ts | 88 +- src/router/modules/components.ts | 31 - src/router/modules/router-demo.ts | 57 - src/views/components/DETabsDemo.vue | 82 + stats.html | 6177 ------------------------ tsconfig.node.json | 3 +- 8 files changed, 318 insertions(+), 6306 deletions(-) create mode 100644 src/components/dataease-tabs/index.vue delete mode 100644 src/router/modules/components.ts delete mode 100644 src/router/modules/router-demo.ts create mode 100644 src/views/components/DETabsDemo.vue delete mode 100644 stats.html diff --git a/.gitignore b/.gitignore index 38adffa..7153a7c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist dist-ssr coverage *.local +.prettierrc.js /cypress/videos/ /cypress/screenshots/ diff --git a/src/components/dataease-tabs/index.vue b/src/components/dataease-tabs/index.vue new file mode 100644 index 0000000..b114b07 --- /dev/null +++ b/src/components/dataease-tabs/index.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index de2d0b5..a9ce7b3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,8 +1,8 @@ -import { defineAsyncComponent } from 'vue' -import { type RouteRecordRaw, createRouter, createWebHistory } from 'vue-router' +import { defineAsyncComponent } from 'vue'; +import { type RouteRecordRaw, createRouter, createWebHistory } from 'vue-router'; -export const Layout = () => import('@/layout/index.vue') -const modules: any = import.meta.glob('./modules/*.ts') +export const Layout = () => import('@/layout/index.vue'); +const modules: any = import.meta.glob('./modules/*.ts'); /** 常驻路由 */ export const constantRoutes: RouteRecordRaw[] = [ @@ -18,26 +18,26 @@ export const constantRoutes: RouteRecordRaw[] = [ meta: { title: '首页', icon: 'HomeFilled', - affix: true - } - } - ] + affix: true, + }, + }, + ], }, { path: '/403', component: () => import('@/views/error-page/403.vue'), meta: { - hidden: true - } + hidden: true, + }, }, { path: '/404', component: () => import('@/views/error-page/404.vue'), meta: { - hidden: true + hidden: true, }, - alias: '/:pathMatch(.*)*' + alias: '/:pathMatch(.*)*', }, { path: '/router-demo', @@ -45,7 +45,7 @@ export const constantRoutes: RouteRecordRaw[] = [ name: 'RouterDemo', meta: { title: '路由示例', - icon: 'Share' + icon: 'Share', }, children: [ { @@ -53,16 +53,16 @@ export const constantRoutes: RouteRecordRaw[] = [ component: () => import('@/views/router-demo/RouterDocs.vue'), name: 'RouterDocs', meta: { - title: '官方文档' - } + title: '官方文档', + }, }, { path: 'menu', component: () => import('@/views/router-demo/RouterMenu.vue'), name: 'RouterMenu', meta: { - title: '路由与菜单' - } + title: '路由与菜单', + }, }, { path: 'detail', @@ -70,16 +70,16 @@ export const constantRoutes: RouteRecordRaw[] = [ name: 'RouterDetail', meta: { activeMenu: '/router-demo/menu', - hidden: true - } + hidden: true, + }, }, { path: 'keep-alive', component: () => import('@/views/router-demo/RouterKeepAlive.vue'), name: 'RouterKeepAlive', meta: { - title: '组件缓存' - } + title: '组件缓存', + }, }, { path: 'keep-alive-detail', @@ -88,10 +88,10 @@ export const constantRoutes: RouteRecordRaw[] = [ meta: { cache: true, activeMenu: '/router-demo/menu', - hidden: true - } - } - ] + hidden: true, + }, + }, + ], }, { @@ -100,44 +100,52 @@ export const constantRoutes: RouteRecordRaw[] = [ name: 'Components', meta: { title: '组件', - icon: 'Grid' + icon: 'Grid', }, children: [ + { + path: 'tabs-demo', + component: () => import('@/views/components/DETabsDemo.vue'), + name: 'DETabsDemo', + meta: { + title: 'DE 标签页', + }, + }, { path: 'layout-content', component: () => import('@/views/components/LayoutContentDemo.vue'), name: 'LayoutContentDemo', meta: { - title: '页面布局' - } + title: '页面布局', + }, }, { path: 'card-view', component: () => import('@/views/components/ViewCardDemo.vue'), name: 'ViewCardDemo', meta: { - title: '查看Card' - } - } - ] - } -] + title: '查看Card', + }, + }, + ], + }, +]; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: constantRoutes as RouteRecordRaw[], // 刷新时,滚动条位置还原 - scrollBehavior: () => ({ left: 0, top: 0 }) -}) + scrollBehavior: () => ({ left: 0, top: 0 }), +}); // 重置路由 export function resetRouter() { router.getRoutes().forEach((route) => { - const { name } = route + const { name } = route; if (name && router.hasRoute(name)) { - router.removeRoute(name) + router.removeRoute(name); } - }) + }); } -export default router +export default router; diff --git a/src/router/modules/components.ts b/src/router/modules/components.ts deleted file mode 100644 index e6572e6..0000000 --- a/src/router/modules/components.ts +++ /dev/null @@ -1,31 +0,0 @@ -import Layout from '@/layout/index.vue' - -const ComponentsSetting = { - sort: 2, - path: '/components', - component: Layout, - name: 'Components', - meta: { - title: '组件', - icon: 'Grid' - }, - children: [ - { - path: 'layout-content', - component: () => import('@/views/components/LayoutContentDemo.vue'), - name: 'LayoutContentDemo', - meta: { - title: '页面布局' - } - }, - { - path: 'card-view', - component: () => import('@/views/components/ViewCardDemo.vue'), - name: 'ViewCardDemo', - meta: { - title: '查看Card' - } - } - ] -} -export default ComponentsSetting diff --git a/src/router/modules/router-demo.ts b/src/router/modules/router-demo.ts deleted file mode 100644 index cdc0f5b..0000000 --- a/src/router/modules/router-demo.ts +++ /dev/null @@ -1,57 +0,0 @@ -import Layout from '@/layout/index.vue' - -export default { - sort: 1, - path: '/router-demo', - component: Layout, - name: 'RouterDemo', - meta: { - title: '路由示例', - icon: 'Share' - }, - children: [ - { - path: 'docs', - component: () => import('@/views/router-demo/RouterDocs.vue'), - name: 'RouterDocs', - meta: { - title: '官方文档' - } - }, - { - path: 'menu', - component: () => import('@/views/router-demo/RouterMenu.vue'), - name: 'RouterMenu', - meta: { - title: '路由与菜单' - } - }, - { - path: 'detail', - component: () => import('@/views/router-demo/RouterDetail.vue'), - name: 'RouterDetail', - meta: { - activeMenu: '/router-demo/menu', - hidden: true - } - }, - { - path: 'keep-alive', - component: () => import('@/views/router-demo/RouterKeepAlive.vue'), - name: 'RouterKeepAlive', - meta: { - title: '组件缓存' - } - }, - { - path: 'keep-alive-detail', - component: () => import('@/views/router-demo/RouterKeepAliveDetail.vue'), - name: 'RouterKeepAliveDetail', // cache: true时,必须保证name与component中的name一致 - meta: { - cache: true, - activeMenu: '/router-demo/menu', - hidden: true - } - } - ] -} diff --git a/src/views/components/DETabsDemo.vue b/src/views/components/DETabsDemo.vue new file mode 100644 index 0000000..bddd87e --- /dev/null +++ b/src/views/components/DETabsDemo.vue @@ -0,0 +1,82 @@ + + + diff --git a/stats.html b/stats.html deleted file mode 100644 index f1bf43b..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/tsconfig.node.json b/tsconfig.node.json index 424084a..17323ef 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -3,6 +3,7 @@ "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"], "compilerOptions": { "composite": true, - "types": ["node"] + "types": ["node"], + "allowSyntheticDefaultImports": true } }