components.ts 624 B

12345678910111213141516171819
  1. import Components from 'unplugin-vue-components/vite';
  2. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
  3. import IconsResolver from 'unplugin-icons/resolver';
  4. export default (path: any) => {
  5. return Components({
  6. resolvers: [
  7. // 自动导入 Element Plus 组件
  8. ElementPlusResolver(),
  9. // 自动注册图标组件
  10. IconsResolver({
  11. enabledCollections: ['ep']
  12. })
  13. ],
  14. // 自动导入自定义组件
  15. dirs: [path.resolve(__dirname, '../../src/components')],
  16. dts: path.resolve(path.resolve(__dirname, '../../src'), 'types', 'components.d.ts')
  17. });
  18. };