动态绑定事件
DasCgformFieldForm.vue
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24" v-for="(item,index) in columns">
<a-form-model-item :label="item.title" :labelCol="labelCol" :wrapperCol="wrapperCol" :prop="item.dataIndex">
<span v-else-if="item.type === 'select'">
<a-select v-model="model[item.dataIndex]" default-value="" :style="item.style" v-on:change="handleClick(item.handleChange,index)" >
<a-select-option v-for="(option,index) in item.option " :value="option.value">
{{option.name}}
</a-select-option>
</a-select>
</span>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
data () {
return {
columns: [
{
title:'表代码',
align:"center",
type: 'select',
handleChange: 'tableHandleChange',
option: [
{value:'das_info_archives',name:'档案表'},
],
style: 'width: 100%',
dataIndex: 'dasformHeadCode'
},
],
}
}
methods: {
handleClick(method,index){
//如果定义了事件
if(this[method]){
this[method](index)
}
},
动态事件
tableHandleChange(val){
alert(1)
},
...
}