工作遇到的问题记录下
代码如下(选了其中一行做例子):
<el-table-column label="日期" width="120" align="center">
<template slot-scope="scope">
<span v-if="scope.row.start =='1'">{{scope.row.startDate}}</span>
<el-date-picker
v-model="tableData[scope.$index].startDate"
value-format="yyyy-MM-dd"
placeholder="选择日期"
@change="getDate(tableData[scope.$index].startDate)"
v-if="scope.row.start =='0'"
></el-date-picker>
</template>
因为接口返回的字段找不到可以公共的 可以用来判断 所以自己加了一个新字段进去 用来判断
res.result.courseTurnsTimes[index].start = "1"; 新加了一个Start进去,最后 return res.result.courseTurnsTimes;
点击新增时候
newAdd() {
this.isShowAdd = false;
this.IsOper = true;
this.columnWidth = "320";
this.obj = {
timeName: "",
startDate: "",
startTime: "",
hours: "",
start: "0"
};
this.tableData.push(this.obj);
},
把start复制为0 在html里面就可以通过v-if去判断了