表格嵌套时间组件传参问题

table表格里面嵌套了时间选择器,开始时间-结束时间


```html
 <el-table-column label="生效/截至日期">
          <template slot-scope="scope">
            <el-date-picker v-model="scope.row.timeRange" @change="timeChange" type="daterange" range-separator="至"
              start-placeholder="开始日期" end-placeholder="结束日期" value-format="timestamp">
            </el-date-picker>
          </template>
        </el-table-column>

时间区间timeRange
    watch: {
      timeRange(newVal, oldVal) {
        if (newVal && newVal.length == 2) {
          this.effectiveDate = newVal[0] / 1000;
          this.expiryDate = newVal[1] / 1000
        } else {
          this.effectiveDate = "";
          this.expiryDate = ""
        }
      }
    },



```html
 data() {
      return {
        timeRange: '', //时间区间
        tableData: [{
          rate: '',
          expiryDate: '',
          effectiveDate: '',
          timeRange:[],
        }],
}
}

加了插槽scope后接口传的参数是这种,timeRange是一个数组,需要的格式是开始结束时间分开,这种不加scope可以实现,但是会导致表格的每一层时间数据都一样

img

img

有用的话,请采纳哇!!!

<el-table-column label="开始时间">
  <template slot-scope="scope">
    <el-date-picker
      v-model="scope.row.startTime"
      type="datetime"
      placeholder="选择时间"
      value-format="yyyy-MM-dd HH:mm:ss">
    </el-date-picker>
  </template>
</el-table-column>
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^