v-formly-v3 是 vue 3 的动态(JSON 驱动)表单库。
目前支持Vue 3.x,组件库支持antdv v3 & element-plus,Vue 3.x的其他UI库(DevUI等)支持正在开发中。。。
Stackblitz antdv, CodeSandbox antdv
Stackblitz element, CodeSandbox element
推荐使用 vite cli 搭建项目
搭建完成后:
使用yarn
安装v-formly-v3
:
yarn add v-formly-v3
或者使用npm
安装它:
npm i v-formly-v3 --save
import { createApp } from "vue";
import App from "./App.vue";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.css";
import * as antIcons from "@ant-design/icons-vue";
import VFormly from "v-formly-v3/antdv";
const app = createApp(App);
app.use(Antd);
Object.keys(antIcons).forEach((key) => {
app.component(key, (antIcons as any)[key]);
});
app.config.globalProperties.$antIcons = antIcons;
app.use(VFormly, {
ui: {
errors: {
required: "必填项",
},
},
});
app.mount("#app");
import { createApp } from "vue";
import App from "./App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as elIcons from "@element-plus/icons-vue";
import VFormly from "v-formly-v3/element";
const app = createApp(App);
app.use(ElementPlus);
for (const [key, component] of Object.entries(elIcons)) {
app.component(key, component);
}
app.config.globalProperties.$elIcons = elIcons;
app.use(VFormly, {
lib: "element",
ui: {
errors: {
required: "必填项",
},
},
});
app.mount("#app");
不论是学习还是使用 v-formly-v3,有任何问题可以添加 QQ 群:610930944,我们为你解答关于使用 v-formly-v3 过程中的的任何疑难杂症!
MIT Licensed | Copyright © 2022-present v-formly-v3