Make separate Select2 change event logic based on type
.select2(this.option, [])
.change(function() {
self.$emit('input', this.value);
- self.$emit('change', self.$refs.select2.options[self.selectedIndex()].dataset.revision);
+ if (self.type === 'select') {
+ self.$emit('change', self.getSelectedOptionRevision());
self.$nextTick(() => self.$validator.validate(self.name));
+ } else {
+ self.$emit('change');
+ }
});
}
return this.$refs.select2.options[this.selectedIndex()].dataset.validate;
}
+ getSelectedOptionRevision() {
+ return this.$refs.select2.options[this.selectedIndex()].dataset.revision;
+ }
+
selectedIndex() {
return this.$refs.select2.options.selectedIndex;
}
