Closed reaink closed 2 years ago
插件:https://github.com/antfu/unplugin-vue-components
框架的版本 (UI version) :
"ant-design-vue": "^3.0.0-alpha.12", "@form-create/ant-design-vue": "^3.0.0-alpha.2",
出现错误:
[Vue warn]: Failed to resolve component: aCol If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
复现步骤/生成规则 (Duplicate steps/generate rules) vite中引入
import Components from 'unplugin-vue-components/vite' import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers' // https://github.com/antfu/unplugin-vue-components Components({ extensions: ['vue', 'md'], dts: true, deep: true, include: [/\.vue$/, /\.vue\?vue/, /\.md$/], directoryAsNamespace: true, resolvers: [ // auto import icons // https://github.com/antfu/unplugin-icons IconsResolver({ componentPrefix: 'icon', enabledCollections: ['carbon', 'ci'], }), AntDesignVueResolver({ importLess: true, }), ], }),
main.ts
import formCreate from '@form-create/ant-design-vue' app.use(formCreate)
page.vue
<template> <form-create :rule="rule" v-model:api="fApi" :option="options"/> </template> <script setup lang="ts"> const fApi = ref({}) const rule = ref([ { type: 'input', title: '昵称', field: 'nickname' } ]) const options = { onSubmit(formData: any) { alert(JSON.stringify(formData)) } } </script>
期望的结果 (Desired outcome) 被unplugin-vue-components自动引入
3.1版本会支持按需加载
3.1版本已发布
插件:https://github.com/antfu/unplugin-vue-components
框架的版本 (UI version) :
"ant-design-vue": "^3.0.0-alpha.12", "@form-create/ant-design-vue": "^3.0.0-alpha.2",
出现错误:
复现步骤/生成规则 (Duplicate steps/generate rules) vite中引入
main.ts
page.vue
期望的结果 (Desired outcome) 被unplugin-vue-components自动引入