Select and multi select change option event with (key and value)
This commit is contained in:
parent
48d17ed098
commit
ff7cdb8d8b
@ -428,6 +428,71 @@ export default {
|
||||
this.$emit('interface', this.selected);
|
||||
|
||||
this.$emit('change', this.selected);
|
||||
|
||||
// Option changed sort_option data
|
||||
if (this.group) {
|
||||
this.sort_options.forEach(function (option_group, group_index) {
|
||||
this.option_group.value.forEach(function (option, index) {
|
||||
if (this.multiple) {
|
||||
let indexs = [];
|
||||
let values = [];
|
||||
let labels = [];
|
||||
let options = [];
|
||||
|
||||
this.selected.forEach(function (selected_option_id, selected_index) {
|
||||
if (option.value = this.selected) {
|
||||
indexs.push(selected_index);
|
||||
values.push(option.id);
|
||||
labels.push(option.value);
|
||||
options.push(option);
|
||||
}
|
||||
});
|
||||
|
||||
this.$emit('index', indexs);
|
||||
this.$emit('value', values);
|
||||
this.$emit('label', labels);
|
||||
this.$emit('option', options);
|
||||
} else {
|
||||
if (option.value = this.selected) {
|
||||
this.$emit('index', index);
|
||||
this.$emit('value', option.id);
|
||||
this.$emit('label', option.value);
|
||||
this.$emit('option', option);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
} else {
|
||||
this.sort_options.forEach(function (option, index) {
|
||||
if (this.multiple) {
|
||||
let indexs = [];
|
||||
let values = [];
|
||||
let labels = [];
|
||||
let options = [];
|
||||
|
||||
this.selected.forEach(function (selected_option_id, selected_index) {
|
||||
if (option.value = this.selected) {
|
||||
indexs.push(selected_index);
|
||||
values.push(option.id);
|
||||
labels.push(option.value);
|
||||
options.push(option);
|
||||
}
|
||||
});
|
||||
|
||||
this.$emit('index', indexs);
|
||||
this.$emit('value', values);
|
||||
this.$emit('label', labels);
|
||||
this.$emit('option', options);
|
||||
} else {
|
||||
if (option.value = this.selected) {
|
||||
this.$emit('index', index);
|
||||
this.$emit('value', option.id);
|
||||
this.$emit('label', option.value);
|
||||
this.$emit('option', option);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
||||
visibleChange(event) {
|
||||
|
@ -544,6 +544,71 @@ export default {
|
||||
this.$emit('interface', this.selected);
|
||||
|
||||
this.$emit('change', this.selected);
|
||||
|
||||
// Option changed sort_option data
|
||||
if (this.group) {
|
||||
this.sort_options.forEach(function (option_group, group_index) {
|
||||
this.option_group.value.forEach(function (option, index) {
|
||||
if (this.multiple) {
|
||||
let indexs = [];
|
||||
let values = [];
|
||||
let labels = [];
|
||||
let options = [];
|
||||
|
||||
this.selected.forEach(function (selected_option_id, selected_index) {
|
||||
if (option.value = this.selected) {
|
||||
indexs.push(selected_index);
|
||||
values.push(option.id);
|
||||
labels.push(option.value);
|
||||
options.push(option);
|
||||
}
|
||||
});
|
||||
|
||||
this.$emit('index', indexs);
|
||||
this.$emit('value', values);
|
||||
this.$emit('label', labels);
|
||||
this.$emit('option', options);
|
||||
} else {
|
||||
if (option.value = this.selected) {
|
||||
this.$emit('index', index);
|
||||
this.$emit('value', option.id);
|
||||
this.$emit('label', option.value);
|
||||
this.$emit('option', option);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}, this);
|
||||
} else {
|
||||
this.sort_options.forEach(function (option, index) {
|
||||
if (this.multiple) {
|
||||
let indexs = [];
|
||||
let values = [];
|
||||
let labels = [];
|
||||
let options = [];
|
||||
|
||||
this.selected.forEach(function (selected_option_id, selected_index) {
|
||||
if (option.value = this.selected) {
|
||||
indexs.push(selected_index);
|
||||
values.push(option.id);
|
||||
labels.push(option.value);
|
||||
options.push(option);
|
||||
}
|
||||
});
|
||||
|
||||
this.$emit('index', indexs);
|
||||
this.$emit('value', values);
|
||||
this.$emit('label', labels);
|
||||
this.$emit('option', options);
|
||||
} else {
|
||||
if (option.value = this.selected) {
|
||||
this.$emit('index', index);
|
||||
this.$emit('value', option.id);
|
||||
this.$emit('label', option.value);
|
||||
this.$emit('option', option);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
||||
visibleChange(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user