After the ElementUI DatePicker is directly assigned and echoed, it cannot be changed or deleted.

foreword

When using vue + ElementUI to develop a project, the e-date-picker component is used to select the date range dateRange. When the default dateRange is directly assigned, the value echoed in the component cannot be deleted or modified.

solution

setTemp(){
  // 直接使用下列方式直接赋值,会导致回显无法更改与删除问题
  this.formData.dataRange = ['2022-10-10', '2022-10-12']
  // 改为下面的代码就不会出现上述问题
  this.$set(this.formData, 'dataRange', ['2022-10-10', '2022-10-12'])
}

Guess you like

Origin blog.csdn.net/loveliqi/article/details/130058223