wft-generate-form
适用于uniapp, 该插件将xps-formmaking动态生成的json在uniapp中动态解析出来,大部分功能已处理,部分属性、细节还可以按需进行扩展优化. 依赖于uview-ui,请自行安装
Installation
$ npm install wft-generate-form --save
Usage
<template>
<view class="index">
<wft-generate-form ref="wft-generate-form" :data="myJson" />
<button @tap="submit">提交一下</button>
</view>
</template>
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
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
export default {
namespaced: true,
state: {
status: false
},
mutations: {
UPDATE_STATUS(state, status) {
state.status = status
}
}
}