ng-form-elementplus icon indicating copy to clipboard operation
ng-form-elementplus copied to clipboard

联动关联点击添加按钮没有反应

Open lostimever opened this issue 1 year ago • 0 comments

handleAdd() {
      if (!this.value) {
        this.value = []
      }
      let addData = [
        ...this.value,
        {
          vtype: 1,
          //validator: 'validatorFiled',
          model: '',
          script: '',
          queryKey: '',
          queryValue: '',
        },
      ]
      this.$emit('input', addData)
    }
  1. 这个this.$emit('input', addData)不太理解,通过 input 向上⬆️传参,但是父组件并没有看到@input 来接受处理参数;
  2. props直接通过 this.value 的形式来修改 props 中的 value 属性认为是不明智的;
  3. 另外虽然是 vue3 的版本,但是语法仍然沿用了 vue2 的写法,比如这段 this.$emit 完全可以替换成 emit('input', xxx),以及混合 mixin 用 hooks 来代替
  • 感谢博主的开源

lostimever avatar Jan 16 '24 03:01 lostimever