form 表单不提交时怎么把表单数据抛出到父组件?

onChange(e) {
      this.$nextTick(() => {
        this.form.validateFields((err, values) => {
          if (!err) {
            values = this.valuesTransform(values)
            console.log(values)
            this.$emit('changeCallBack', values)
          }
        })
      })
    },

表单项监听每一次的change事件。然后抛出。

不用 this.$nextTick (回调函数),则每次抛出的数据都是当前change 前一次的数据

 

<component
              :is="item.componentx"
              :key="index"
              :name="item.name"
              :type="item.type"
              :format="item.format"
              :show-time="item.showTime"
              v-decorator="[
                item.name,
                    {
                        initialValue: initialValueHandle(item),
                        rules: rule && item.rules
                    },
              ]"
              @change="onChange"
              style="width: 100%"
            >
              <a-icon v-if="item.after" slot="addonAfter" type="search" />
            </component>

 

相关文章:

  • 2021-12-21
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2021-06-02
  • 2021-11-27
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案