1 Star 0 Fork 5

sunzhouhui / vue-generate-form

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

vue-form-maker

简介

Vue动态生成表单组件 可以根据数据配置表单 使用的UI库是iView
在Vue里 一般要用到什么组件或数据 都得提前声明
所以要根据数据来生成表单 只能使用Vue的render函数
要做这一个组件 其实并不难 看一下Vue官方示例 再找个UI组件库 差不多就能写出来
如果对项目有兴趣 可以fork或克隆项目 自行研究
有问题或BUG欢迎提issues

文档

在线DEMO

表单组件

  • Input 输入框
  • Button 按钮
  • Radio 单选框
  • Checkbox 多选框
  • Icon 图标
  • Switch 开关
  • Select 选择器
  • Slider 滑块
  • DatePicker 日期选择器
  • TimePicker 时间选择器
  • Cascader 级联选择器
  • InputNumber 数字输入框
  • Rate 评分
  • Upload 上传
  • ColorPicker 颜色选择器

使用

在单文件组件中引用

npm i vue-form-maker
import VueFormMaker from 'vue-form-maker'
import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
// 如需使用城市数据 可以这样引用
// 省 市 县
import 'vue-form-maker/dist/cityData3Level'
// 省 市
import 'vue-form-maker/dist/cityData2Level'
// 城市数据文件定义了一个全局变量cityData 在项目里直接使用cityData即可

Vue.use(ViewUI)
Vue.use(VueFormMaker)
<template>
    <div id="app">
        <VueFormMaker :options="options"/>
        // 或者 <vue-form-maker :options="options"/>
    </div>
</template>

在HTML文件中直接引用

使用的是dist目录中的vue-form-maker.js

<link rel="stylesheet" type="text/css" href="iview.css">
<div id="app">
    <!-- 在 HTML 中使用组件要这样使用,不能这样用 <vue-form-maker :options="options"/>,否则后面的元素渲染不出来 -->
    <vue-form-maker :options="options"></vue-form-maker>
</div>
<script src="vue.js"></script>
<script src="iview.js"></script>
<script src="vue-form-maker.js"></script>

如果对你有帮助,请给个Star

MIT License Copyright (c) 2018 bin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

简介 Vue动态生成表单组件 可以根据数据配置表单 使用的UI库是iView  整体组件布局方式借鉴了form-create的写法 在此表示感谢 在Vue里 一般要用到什么组件或数 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/sunzhouhui/vue-generate-form.git
git@gitee.com:sunzhouhui/vue-generate-form.git
sunzhouhui
vue-generate-form
vue-generate-form
master

搜索帮助