Commit 8791ea214c787b41e0ddc49318e0da1c1d9b4720

Authored by 芋道源码
Committed by Gitee
2 parents 2a332a95 d207b95b

!381 vue3 优化第一次进入加载速度

Merge pull request !381 from xingyu/dev
yudao-ui-admin-vue3/.env.base
1 1 # 本地开发环境
2 2 NODE_ENV=development
3 3  
  4 +VITE_DEV=true
  5 +
4 6 # 请求路径
5 7 VITE_BASE_URL='http://localhost:48080'
6 8  
... ...
yudao-ui-admin-vue3/.env.dev
1 1 # 开发环境
2 2 NODE_ENV=production
3 3  
  4 +VITE_DEV=false
  5 +
4 6 # 请求路径
5 7 VITE_BASE_URL='http://localhost:48080'
6 8  
... ...
yudao-ui-admin-vue3/.env.pro
1 1 # 生产环境
2 2 NODE_ENV=production
3 3  
  4 +VITE_DEV=false
  5 +
4 6 # 请求路径
5 7 VITE_BASE_URL='http://localhost:48080'
6 8  
... ...
yudao-ui-admin-vue3/.env.test
1 1 # 测试环境
2 2 NODE_ENV=production
3 3  
  4 +VITE_DEV=false
  5 +
4 6 # 请求路径
5 7 VITE_BASE_URL='http://localhost:48080'
6 8  
... ...
yudao-ui-admin-vue3/src/components/XTable/src/XTable.vue
... ... @@ -255,16 +255,17 @@ const getToolBarConfig = (options: XTableProps) => {
255 255 if (toolbarConfig) return
256 256 if (toolBar) {
257 257 if (!isBoolean(toolBar)) {
  258 + console.info(2)
258 259 options.toolbarConfig = toolBar
259 260 return
260 261 }
261   - } else if (!topActionSlots) {
  262 + } else if (topActionSlots != false) {
262 263 options.toolbarConfig = {
263   - enabled: true
  264 + slots: { buttons: 'toolbar_buttons' }
264 265 }
265 266 } else {
266 267 options.toolbarConfig = {
267   - slots: { buttons: 'toolbar_buttons' }
  268 + enabled: true
268 269 }
269 270 }
270 271 }
... ...
yudao-ui-admin-vue3/src/main.ts
... ... @@ -37,6 +37,13 @@ import App from './App.vue'
37 37  
38 38 import './permission'
39 39  
  40 +import { isDevMode } from '@/utils/env'
  41 +
  42 +if (isDevMode()) {
  43 + console.info(isDevMode())
  44 + import('element-plus/dist/index.css')
  45 +}
  46 +
40 47 // 创建实例
41 48 const setupAll = async () => {
42 49 const app = createApp(App)
... ...
yudao-ui-admin-vue3/src/types/auto-components.d.ts
... ... @@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
21 21 DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default']
22 22 Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
23 23 Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
  24 + ElAvatar: typeof import('element-plus/es')['ElAvatar']
24 25 ElBadge: typeof import('element-plus/es')['ElBadge']
25 26 ElButton: typeof import('element-plus/es')['ElButton']
26 27 ElCard: typeof import('element-plus/es')['ElCard']
... ... @@ -30,6 +31,7 @@ declare module '@vue/runtime-core' {
30 31 ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
31 32 ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
32 33 ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
  34 + ElDialog: typeof import('element-plus/es')['ElDialog']
33 35 ElDivider: typeof import('element-plus/es')['ElDivider']
34 36 ElDrawer: typeof import('element-plus/es')['ElDrawer']
35 37 ElDropdown: typeof import('element-plus/es')['ElDropdown']
... ... @@ -38,6 +40,7 @@ declare module '@vue/runtime-core' {
38 40 ElForm: typeof import('element-plus/es')['ElForm']
39 41 ElFormItem: typeof import('element-plus/es')['ElFormItem']
40 42 ElIcon: typeof import('element-plus/es')['ElIcon']
  43 + ElImage: typeof import('element-plus/es')['ElImage']
41 44 ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
42 45 ElInput: typeof import('element-plus/es')['ElInput']
43 46 ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
... ... @@ -48,10 +51,14 @@ declare module '@vue/runtime-core' {
48 51 ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
49 52 ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
50 53 ElRow: typeof import('element-plus/es')['ElRow']
  54 + ElScroll: typeof import('element-plus/es')['ElScroll']
51 55 ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
52 56 ElSelect: typeof import('element-plus/es')['ElSelect']
53 57 ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
  58 + ElSpace: typeof import('element-plus/es')['ElSpace']
54 59 ElSwitch: typeof import('element-plus/es')['ElSwitch']
  60 + ElTable: typeof import('element-plus/es')['ElTable']
  61 + ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
55 62 ElTabPane: typeof import('element-plus/es')['ElTabPane']
56 63 ElTabs: typeof import('element-plus/es')['ElTabs']
57 64 ElTag: typeof import('element-plus/es')['ElTag']
... ...
yudao-ui-admin-vue3/src/utils/env.ts 0 → 100644
  1 +export const isDevMode = () => {
  2 + const dev = import.meta.env.VITE_DEV
  3 + if (dev && dev === true) {
  4 + return true
  5 + } else {
  6 + return false
  7 + }
  8 +}
... ...
yudao-ui-admin-vue3/src/views/infra/swagger/index.vue
... ... @@ -5,5 +5,6 @@
5 5 </template>
6 6 <script setup lang="ts" name="Swagger">
7 7 const BASE_URL = import.meta.env.VITE_BASE_URL
8   -const src = ref(BASE_URL + '/doc.html')
  8 +// const src = ref(BASE_URL + '/doc.html')
  9 +const src = ref(BASE_URL + '/swagger-ui')
9 10 </script>
... ...
yudao-ui-admin-vue3/src/views/system/user/index.vue
... ... @@ -8,17 +8,19 @@
8 8 </div>
9 9 </template>
10 10 <el-input v-model="filterText" placeholder="搜索部门" />
11   - <el-tree
12   - ref="treeRef"
13   - node-key="id"
14   - default-expand-all
15   - :data="deptOptions"
16   - :props="defaultProps"
17   - :highlight-current="true"
18   - :filter-node-method="filterNode"
19   - :expand-on-click-node="false"
20   - @node-click="handleDeptNodeClick"
21   - />
  11 + <el-scrollbar height="650">
  12 + <el-tree
  13 + ref="treeRef"
  14 + node-key="id"
  15 + default-expand-all
  16 + :data="deptOptions"
  17 + :props="defaultProps"
  18 + :highlight-current="true"
  19 + :filter-node-method="filterNode"
  20 + :expand-on-click-node="false"
  21 + @node-click="handleDeptNodeClick"
  22 + />
  23 + </el-scrollbar>
22 24 </el-card>
23 25 <el-card class="w-4/5 user" style="margin-left: 10px" :gutter="12" shadow="hover">
24 26 <template #header>
... ... @@ -534,8 +536,8 @@ onMounted(async () =&gt; {
534 536  
535 537 <style scoped>
536 538 .user {
537   - height: 900px;
538   - max-height: 960px;
  539 + height: 780px;
  540 + max-height: 800px;
539 541 }
540 542 .card-header {
541 543 display: flex;
... ...
yudao-ui-admin-vue3/types/env.d.ts
... ... @@ -11,6 +11,7 @@ interface ImportMetaEnv {
11 11 readonly VITE_APP_TITLE: string
12 12 readonly VITE_PORT: number
13 13 readonly VITE_OPEN: string
  14 + readonly VITE_DEV: boolean
14 15 readonly VITE_ROUTE_ALWAYSSHOW_ENABLE: string
15 16 readonly VITE_APP_CAPTCHA_ENABLE: string
16 17 readonly VITE_APP_TENANT_ENABLE: string
... ...