Created
July 30, 2019 07:44
-
-
Save aloha1003/ec8ceded7668ced41432de2cb345ab63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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