GithubHelp home page GithubHelp logo

lynshine / vue-form-maker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from woai3c/vue-form-maker

0.0 1.0 0.0 1.47 MB

vue表单生成器 动态生成表单组件

License: MIT License

JavaScript 100.00%

vue-form-maker's Introduction

vue-form-maker

简介

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

表单组件

  • 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.