element radio与element checkbox

element radio的handleChange事件

handleChange() {
      this.$nextTick(() => {
        this.$emit("change", this.model);
        this.isGroup &&
          this.dispatch("ElRadioGroup", "handleChange", this.model);
      });
    },

element checkbox的handleChange事件

handleChange(ev) {
      if (this.isLimitExceeded) return;
      let value;
      if (ev.target.checked) {
        value = this.trueLabel === undefined ? true : this.trueLabel;
      } else {
        value = this.falseLabel === undefined ? false : this.falseLabel;
      }
      this.$emit("change", value, ev);
      this.$nextTick(() => {
        if (this.isGroup) {
          this.dispatch("ElCheckboxGroup", "change", [
            this._checkboxGroup.value,
          ]);
        }
      });
    },

这两个同样事件为什么checkbox的change不需要放入$nextTick中执行

阅读 592
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题