[Vue warn]: Invalid watch source:

A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.

vue3 中watch对象写法错误;应改为()=> 对象;

解决:

  watch(() => _.cloneDeep(props.obj), (newValue, oldValue) => {
    
  }, {deep: true})


//  import _ from "lodash";
//   _.cloneDeep 是解决多次watch 对象
Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐