<el-col :span="items[item].col || 12" class="detail-item" v-for="item in table["items"]" :key="item.id">
<template v-if="table.modal.modifyModel && items[item].editable!==false">
<el-select v-model="table.formData[items[item].name]" :placeholder="items[item].label" v-if="items[item].type==="select"" @change="items[item].changeFunc()">
<el-option :label="opt.LABEL" :value="opt.VALUE" :key="opt.KEY" v-for="opt in items[item].options"></el-option>
</el-select>
<el-input v-model="table.formData[items[item].name]" v-else></el-input>
</template>
</el-col>
I want to dynamically add the @ change attribute to el-select, because not every loop has the parameter items [item] .changeFunc, so @ change is not needed when there is no parameter.
is written as @ change= "items.changeFunc () | |""" will report an error not function
as @ change= "items.changeFunc () | | return true" neither can
leave @ change= "items.changeFunc ()" so that when you click on another select that has no changed attribute, it will also report an error not function
with v-if, it will be the same as writing two lines, but one with @ change and one without redundancy.
do not know that there is anything in the syntax of vue that can implement this simple requirement?