<template>
  <div id="two">
    <el-row>
      <el-col :span="24" class="main">
        <el-form :model="form" :rules="rules" ref="form" label-width="80px">
          <template v-for="(i, index) in question">
            <el-col :span="8" :key="`two${index}`">
              <el-form-item v-if="i.type === 'select'" :prop="`${index}`" :key="`two${index}`" :label="`${i.label}`">
                <el-select v-model="form[i.model]" placeholder="">
                  <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-col>
    </el-row>
  </div>
</template>

<script>
import { two } from '../fields.js';
import * as select from '../select.js';
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'two',
  props: {
    form: { type: Object },
    rules: { type: Object },
  },
  model: {
    prop: 'form',
    event: 'change',
  },
  components: {},
  data: function() {
    return {
      question: two,
    };
  },
  created() {},
  methods: {
    // 获取列表
    getList(type) {
      return select[type];
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-input__inner {
  border: 1px solid #333;
}
</style>
