在 template 中复制代码
<template v-for="(item, key, index) in association">
<el-form-item :key="index" :label="item.text">
<component :is="item.type" v-model="memberForm[key]" :placeholder="item.placeholder"
:type="item.inputType">
<el-option v-if="item.type == 'el-select'" :value="1" label="是"></el-option>
<el-option v-if="item.type == 'el-select'" :value="0" label="否"></el-option>
</component>
</el-form-item>
</template>
在data里面写
association: {
100118339: {
guild_job: {
text: '会员类别',
placeholder: '请输入会员类别(会员或理事',
type: 'el-input',
},
industry: {
text: '服务领域',
placeholder: '请输入主要志愿服务领域',
type: 'el-input',
},
},
},