xaboy / form-create

:fire::fire::fire: 强大的低代码动态表单组件,通过数据驱动表单渲染,适配移动端,支持可视化设计。提高开发者对表单的开发效率。目前在政务系统、OA系统、ERP系统、电商系统、流程管理等系统中已稳定应用。
https://www.form-create.com/
MIT License
6.03k stars 972 forks source link

使用 unplugin-vue-components/resolvers, AntDesignVueResolver插件按需引入时 aCol 等组件未被识别到自动引入 #429

Closed reaink closed 2 years ago

reaink commented 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自动引入

xaboy commented 2 years ago

3.1版本会支持按需加载

xaboy commented 2 years ago

3.1版本已发布