建设网站多少费用,上海杨浦区建设网站,软件外包服务内容,烟台网站制作设计vue 的cascader研究了好长时间#xff0c;看了官网给的示例#xff0c;上网查找了好多信息#xff0c;才解决修改时回显的问题#xff0c;现将方法总结如下#xff1a;
vue代码#xff1a;
el-form-item label芯片 propfirmware 看了官网给的示例上网查找了好多信息才解决修改时回显的问题现将方法总结如下
vue代码
el-form-item label芯片 propfirmware el-cascader refcascader :optionsfirmwareTypeOptions v-modelform.firmware placeholder请选择固件版本类型 stylewidth:100%/el-cascader /el-form-item
js:
data中
// 父节点 firmwareTypeOptions:null,
firmwareMaps: { value:null, label: null, children: null
}
---------------------------方法实现-------------------------
getDictsOne(){ getDicts(this.inverterFirmwareVersionType).then(response { // 定义数组 const nodes[]; var arrresponse.data; for(let i 0; i arr.length; i) { let maps[]; // 赋值 maps.valuearr[i].dictValue; maps.labelarr[i].dictLabel; // 网络模块子模块 if(parseInt(arr[i].dictValue)1){ getDicts(this.inverterFirmwareNetworkModule).then(response { const nodess response.data.map((i, index) ({ value: i.dictValue, label: i.dictLabel, })); maps.childrennodess; }); } // 主控模块子模块 if(parseInt(arr[i].dictValue)2){ getDicts(this.inverterFirmwareMainModule).then(response { const nodess response.data.map((i, index) ({ value: i.dictValue, label: i.dictLabel, })); maps.childrennodess; }); } nodes.push(maps); } this.firmwareTypeOptionsnodes; }); }
效果