百度了很长时间,结果一行代码解决.............
上代码
<el-form-item label="城市名称" prop="cityName"> <el-cascader v-model="form.cityName" :options="deptOptions" placeholder="请选择城市名称" :show-all-levels="false" :props="customProps" @change="change" style="width: 100%"></el-cascader> </el-form-item>
/** 修改按钮操作 */ handleUpdate(row) { // this.reset(); const number = row.number || this.ids getRoute(number).then(response => { this.form = response.data;//返回的cityId是String类型 var cityName=response.data.cityId; this.form.cityName=Number(cityName);//数组需要的Number类型 this.open = true; this.title = "修改通勤路线"; });