Skip to content

Instantly share code, notes, and snippets.

@xl1
Created September 9, 2020 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xl1/85005f4b35261d931e839ca2f9aea817 to your computer and use it in GitHub Desktop.
Save xl1/85005f4b35261d931e839ca2f9aea817 to your computer and use it in GitHub Desktop.
<select> を vue component にするときの最小コピペ元 (options API)
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