Created
September 9, 2020 15:26
-
-
Save xl1/85005f4b35261d931e839ca2f9aea817 to your computer and use it in GitHub Desktop.
<select> を vue component にするときの最小コピペ元 (options API)
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
let options; | |
export const CustomSelect = { | |
template: ` | |
<select @change="$emit('input', $event.target.value)"> | |
<option v-for="e in options" :key="e.key" :value="e.value" :selected="e.value === value">{{ e.label }}</option> | |
</select>`, | |
props: { | |
value: String | |
}, | |
data() { | |
return { options }; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment