UNPKG

wft-generate-form

Version:

基于web端xps-formmaking生成的json在uniapp中动态解析

80 lines (68 loc) 1.35 kB
# wft-generate-form 适用于uniapp, 该插件将xps-formmaking动态生成的json在uniapp中动态解析出来,大部分功能已处理,部分属性、细节还可以按需进行扩展优化. 依赖于uview-ui,请自行安装 ## Installation ```shell $ npm install wft-generate-form --save ``` ## Usage ```html <template> <view class="index"> <wft-generate-form ref="wft-generate-form" :data="myJson" /> <button @tap="submit">提交一下</button> </view> </template> ``` ```js import { WftGenerateForm, testJson } from "wft-generate-form"; export default { data() { return { myJson: {}, }; }, components: { WftGenerateForm }, onLoad() { setTimeout(() => { this.myJson = testJson; }, 100); }, methods: { submit() { this.$refs["wft-generate-form"].getData().then((data) => { console.log(data); }); }, }, }; ``` ### store/index.js ```js import Vue from "vue" import Vuex from 'vuex' import validate from './modules/validate.js' Vue.use(Vuex) export default new Vuex.Store({ modules: { validate } }) ``` ### store/modules/validate.js ```js export default { namespaced: true, state: { status: false }, mutations: { UPDATE_STATUS(state, status) { state.status = status } } } ``` ## gitee https://gitee.com/wang-futai/dynamic-form-app