Skip to content

Instantly share code, notes, and snippets.

@aloha1003
Created July 30, 2019 07:44
Show Gist options
  • Save aloha1003/ec8ceded7668ced41432de2cb345ab63 to your computer and use it in GitHub Desktop.
Save aloha1003/ec8ceded7668ced41432de2cb345ab63 to your computer and use it in GitHub Desktop.
const vueSelectExtend = {
methods: {
selectedPersonOutput(options, column, val) {
return options.find((option) => option[column] === val)
},
optionChange(val, valColumn, dataTarget, dataColumn) {
if (val === undefined || val === null) {
dataTarget[dataColumn] = ''
return ''
}
dataTarget[dataColumn] = val[valColumn]
return val
},
},
};
export default vueSelectExtend;
usage:
<v-select label="name"
:value="selectedPersonOutput(list,'id',data.console_id)"
@input="optionChange($event, 'id', data, 'console_id')"
:options="list"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment