feat(projects): 支持 pro-naive-ui 配置表单的按需加载

This commit is contained in:
Zheng-Changfu
2025-05-15 19:10:20 +08:00
parent 348353b7a7
commit e467692590
3 changed files with 21 additions and 1 deletions

View File

@@ -1,6 +1,13 @@
import { createApp } from 'vue';
import './plugins/assets';
import { setupAppVersionNotification, setupDayjs, setupIconifyOffline, setupLoading, setupNProgress } from './plugins';
import {
setupAppVersionNotification,
setupDayjs,
setupIconifyOffline,
setupLoading,
setupNProgress,
setupProNaiveComponents
} from './plugins';
import { setupStore } from './store';
import { setupRouter } from './router';
import { setupI18n } from './locales';
@@ -21,6 +28,8 @@ async function setupApp() {
await setupRouter(app);
setupProNaiveComponents(app);
setupI18n(app);
setupAppVersionNotification();

10
src/plugins/components.ts Normal file
View File

@@ -0,0 +1,10 @@
import type { App } from 'vue';
import { ProDate, ProDateTime, ProInput, ProRate, create } from 'pro-naive-ui';
/** pro-naive-ui 支持配置表单的按需加载,所以需要注册 */
export function setupProNaiveComponents(app: App) {
const proNaive = create({
components: [ProInput, ProDate, ProDateTime, ProRate]
});
app.use(proNaive);
}

View File

@@ -1,5 +1,6 @@
export * from './loading';
export * from './nprogress';
export * from './components';
export * from './iconify';
export * from './dayjs';
export * from './app';