Skip to content

Commit e1e5700

Browse files
author
hikki
committed
7.1
1 parent 8883c34 commit e1e5700

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

resources/assets/component.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ window.ComponentCascadeDot = class {
620620
} else {
621621
this.DOM = document.querySelector(selector);
622622
}
623+
this._triggerEvent = {func:null,enable:false};
623624
this.limit = 0;
624625
this.select = select;
625626
this.selected_data = [];
@@ -718,7 +719,9 @@ window.ComponentCascadeDot = class {
718719
});
719720
if (data.checked === false) {
720721
if (this.limit > 0 && this.select_data.length >= this.limit && (this.SELECTED_DOM.firstChild instanceof HTMLElement)) {
722+
this._triggerEvent.enable = false;
721723
this.SELECTED_DOM.firstChild.click();
724+
this._triggerEvent.enable = true;
722725
}
723726
data.checked = true;
724727
this._tagCal(data.key, this.MODE.insert);
@@ -856,7 +859,7 @@ window.ComponentCascadeDot = class {
856859
if (this.insertInputDOM instanceof HTMLElement) this.insertInputDOM.value = JSON.stringify(this.insert_data);
857860
}
858861
}
859-
if (typeof this._triggerEvent == 'function') this._triggerEvent(this.select_data, this.insert_data, this.delete_data);
862+
if (typeof this._triggerEvent.func == 'function' && this._triggerEvent.enable === true) this._triggerEvent.func(this.select_data, this.insert_data, this.delete_data);
860863
};
861864

862865
this._search = function (search) {
@@ -945,7 +948,9 @@ window.ComponentCascadeDot = class {
945948
this._bind = function () {
946949
setTimeout(() => {
947950
this.selected_label_dom.forEach((D) => {
951+
this._triggerEvent.enable = false;
948952
D.click();
953+
this._triggerEvent.enable = true;
949954
});
950955
});
951956
if (this.selectInputDOM instanceof HTMLElement) this.selectInputDOM.value = JSON.stringify(this.select_data);
@@ -967,7 +972,7 @@ window.ComponentCascadeDot = class {
967972

968973
trigger(f = function () {
969974
}) {
970-
this._triggerEvent = f;
975+
this._triggerEvent = {func:f,enable:true};
971976
return this;
972977
}
973978

0 commit comments

Comments
 (0)