form-create V2
made with
Vuejs
简介及使用教程
form-create 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成器。并且支持生成任何 Vue 组件。结合内置17种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。
form-create是基于vue.js开发,有iView、ElementUI、Ant Design Vue等多个版本。
安装
iview 2.x|3.x
npm
npm install @form-create/iview
yarn
yarn add @form-create/iview
iview 4.x
npm
npm install @form-create/iview4
yarn
yarn add @form-create/iview
浏览器引入
<!-- import Vue.js -->
<script src="//vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
<link rel="stylesheet" href="//unpkg.com/iview/dist/styles/iview.css">
<!-- import iView -->
<script src="//unpkg.com/iview/dist/iview.min.js"></script>
<!-- import form-create/iview -->
<script src="//unpkg.com/@form-create/iview/dist/form-create.min.js"></script>
elementUI
npm
npm install @form-create/element-ui
yarn
yarn add @form-create/iview
浏览器引入
<!-- import Vue.js -->
<script src="//vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- import element -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!-- import form-create/element -->
<script src="//unpkg.com/@form-create/element-ui/dist/form-create.min.js"></script>
ant-design-vue
npm
npm install @form-create/ant-design-vue
yarn
yarn add @form-create/iview
浏览器引入
<!-- import Vue.js -->
<script src="//vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
<link href="https://unpkg.com/ant-design-vue@1.5.3/dist/antd.min.css" rel="stylesheet">
<!-- import moment -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/locale/zh-cn.js"></script>
<!-- import ant-design-vue -->
<script defer src="https://unpkg.com/ant-design-vue@1.5.3/dist/antd.js"></script>
<!-- import form-create -->
<script src="//unpkg.com/@form-create/ant-design-vue/dist/form-create.min.js"></script>
使用
引入
iview
import formCreate from '@form-create/iview'
Vue.use(formCreate)
ElementUI
import formCreate from '@form-create/element-ui'
Vue.use(formCreate)
ant-design-vue
import formCreate from '@form-create/ant-design-vue'
Vue.use(formCreate)
使用
<form-create ref="fc" v-model="fApi" :rule="rule" :option="option"></form-create>
示例
作者
xaboy
@xaboy相关项目