|
@@ -1,9 +1,17 @@
|
|
<template>
|
|
<template>
|
|
- <div id="one">
|
|
|
|
|
|
+ <div id="two">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24" class="main">
|
|
<el-col :span="24" class="main">
|
|
<el-form :model="form" :rules="rules" ref="form" label-width="80px">
|
|
<el-form :model="form" :rules="rules" ref="form" label-width="80px">
|
|
- 1
|
|
|
|
|
|
+ <template v-for="(i, index) in question">
|
|
|
|
+ <el-col :span="8" :key="`question${index}`">
|
|
|
|
+ <el-form-item v-if="i.type === 'select'" :prop="`${index}`" :key="`question${index}`" :label="`${i.label}`">
|
|
|
|
+ <el-select v-model="form[i.model]">
|
|
|
|
+ <el-option v-for="(item, index) in getList(i.list)" :key="index" :value="item" :label="item"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </template>
|
|
</el-form>
|
|
</el-form>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -11,25 +19,35 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { one } from '../fields.js';
|
|
|
|
|
|
+import { two } from '../fields.js';
|
|
|
|
+import * as select from '../select.js';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
export default {
|
|
export default {
|
|
- name: 'one',
|
|
|
|
|
|
+ name: 'two',
|
|
props: {
|
|
props: {
|
|
form: { type: Object },
|
|
form: { type: Object },
|
|
rules: { type: Object },
|
|
rules: { type: Object },
|
|
},
|
|
},
|
|
|
|
+ model: {
|
|
|
|
+ prop: 'form',
|
|
|
|
+ event: 'change',
|
|
|
|
+ },
|
|
components: {},
|
|
components: {},
|
|
data: function() {
|
|
data: function() {
|
|
return {
|
|
return {
|
|
disabled: false,
|
|
disabled: false,
|
|
- question: one,
|
|
|
|
|
|
+ question: two,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
console.log(this.question);
|
|
console.log(this.question);
|
|
},
|
|
},
|
|
- methods: {},
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ // 获取列表
|
|
|
|
+ getList(type) {
|
|
|
|
+ return select[type];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|
|
},
|
|
},
|