vue v-model 绑定动态变量
data() {
return {
search: { //查询参数
keyword: "",
productSpec:""
},
tagSearchModel: {},
}
//设置属性值
reponse.data.FObject.forEach(item => {
this.$set(this.tagSearchModel, "line_" + item.FTagID, "");
});
Html上使用:
<el-form-item :label="item.FTagName" v-for="(item,index) in basicData.tagList">
<el-autocomplete v-model="tagSearchModel['line_' + item.FTagID]"
:fetch-suggestions="((queryString,cb)=>{querySearchAsync(queryString,cb,item)})"
placeholder="请输入内容"
:trigger-on-focus="false"
@select="handleSelect(item.FTagName,$event)">
<el-button slot="append" icon="el-icon-search" @click="openSelectDialog(item,'帘身')"></el-button>
</el-autocomplete>
</el-form-item>
//打印看看是否动态绑定了
// alert(eval("this.tagSearchModel.line_" + 3041));