Skip to content

Commit

Permalink
perf: optimize local startup speed and add header Class configuration…
Browse files Browse the repository at this point in the history
… to drawer
  • Loading branch information
anncwb committed Nov 9, 2024
1 parent da7d61b commit 550b0f9
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 313 deletions.
6 changes: 6 additions & 0 deletions docs/.vitepress/config/shared.mts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export const shared = defineConfig({
postcssIsolateStyles({ includeFiles: [/vp-doc\.css/] }),
],
},
preprocessorOptions: {
scss: {
api: 'modern',
},
},
},
json: {
stringify: true,
Expand Down Expand Up @@ -97,6 +102,7 @@ export const shared = defineConfig({
host: true,
port: 6173,
},

ssr: {
external: ['@vue/repl'],
},
Expand Down
6 changes: 4 additions & 2 deletions internal/vite-config/src/config/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path, { relative } from 'node:path';

import { findMonorepoRoot } from '@vben/node-utils';

import { NodePackageImporter } from 'sass';
import { defineConfig, loadEnv, mergeConfig } from 'vite';

import { defaultImportmapOptions, getDefaultPwaOptions } from '../options';
Expand Down Expand Up @@ -85,7 +86,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
clientFiles: [
'./index.html',
'./src/bootstrap.ts',
'./src/{views,layouts,router,store,api}/*',
'./src/{views,layouts,router,store,api,adapter}/*',
],
},
},
Expand Down Expand Up @@ -113,7 +114,8 @@ function createCssOptions(injectGlobalScss = true) {
}
return content;
},
api: 'modern-compiler',
api: 'modern',
importers: [new NodePackageImporter()],
},
}
: {},
Expand Down
29 changes: 0 additions & 29 deletions internal/vite-config/src/plugins/vxe-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,6 @@ import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import';

async function viteVxeTableImportsPlugin(): Promise<PluginOption> {
return [
// {
// config() {
// return {
// optimizeDeps: {
// include: [
// 'vxe-pc-ui/es/vxe-button/index.js',
// 'vxe-pc-ui/es/vxe-checkbox/index.js',
// 'vxe-pc-ui/es/vxe-icon/index.js',
// 'vxe-pc-ui/es/vxe-input/index.js',
// 'vxe-pc-ui/es/vxe-loading/index.js',
// 'vxe-pc-ui/es/vxe-modal/index.js',
// 'vxe-pc-ui/es/vxe-pager/index.js',
// 'vxe-pc-ui/es/vxe-radio-group/index.js',
// 'vxe-pc-ui/es/vxe-select/index.js',
// 'vxe-pc-ui/es/vxe-tooltip/index.js',
// 'vxe-pc-ui/es/vxe-ui/index.js',
// 'vxe-pc-ui/es/vxe-upload/index.js',
// 'vxe-table/es/vxe-colgroup/index.js',
// 'vxe-table/es/vxe-column/index.js',
// 'vxe-table/es/vxe-grid/index.js',
// 'vxe-table/es/vxe-table/index.js',
// 'vxe-table/es/vxe-toolbar/index.js',
// 'vxe-table/es/vxe-ui/index.js',
// ],
// },
// };
// },
// name: 'vxe-table-adapter',
// },
lazyImport({
resolvers: [
VxeResolver({
Expand Down
10 changes: 9 additions & 1 deletion packages/@core/ui-kit/popup-ui/src/drawer/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface DrawerProps {
* 取消按钮文字
*/
cancelText?: string;
class?: string;
class?: any;
/**
* 是否显示右上角的关闭按钮
* @default true
Expand Down Expand Up @@ -42,6 +42,14 @@ export interface DrawerProps {
* @default true
*/
footer?: boolean;
/**
* 弹窗底部样式
*/
footerClass?: any;
/**
* 弹窗头部样式
*/
headerClass?: any;
/**
* 弹窗是否显示
* @default false
Expand Down
19 changes: 15 additions & 4 deletions packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const {
contentClass,
description,
footer: showFooter,
footerClass,
headerClass,
loading: showLoading,
modal,
openAutoFocus,
Expand Down Expand Up @@ -130,9 +132,13 @@ function handleFocusOutside(e: Event) {
>
<SheetHeader
:class="
cn('!flex flex-row items-center justify-between border-b px-6 py-5', {
'px-4 py-3': closable,
})
cn(
'!flex flex-row items-center justify-between border-b px-6 py-5',
headerClass,
{
'px-4 py-3': closable,
},
)
"
>
<div>
Expand Down Expand Up @@ -186,7 +192,12 @@ function handleFocusOutside(e: Event) {

<SheetFooter
v-if="showFooter"
class="w-full flex-row items-center justify-end border-t p-2 px-3"
:class="
cn(
'w-full flex-row items-center justify-end border-t p-2 px-3',
footerClass,
)
"
>
<slot name="prepend-footer"></slot>
<slot name="footer">
Expand Down
Loading

0 comments on commit 550b0f9

Please sign in to comment.