[Vue warn]: Avoid adding reactive properties to a Vue instance or its root $data at runtime - declare it upfront in the data option.
报错原因:this.$set() 中传入的数据有问题
如:
this.$set(this, endTime, ‘2021-11-17’) 这是给vue组件中的endTime字段赋值,但是andTime数据类型是ts中的any,相当于vue组件中的data没有定义endTime这个字段,就会报错
// 报错代码
this.testObj = {
name: 'test'
}
this.$set(this.testObj, 'noPropertyName', value)
正确的格式: