Element vite 按需引入的 模板代码

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'; // 新增的导入语句
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
        // ...
        AutoImport({
          resolvers: [ElementPlusResolver()],
        }),
        Components({
          resolvers: [ElementPlusResolver()],
        }),
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
})

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注