Skip to content

Instantly share code, notes, and snippets.

@mehdinourollah
Created July 7, 2021 15:53
Show Gist options
  • Save mehdinourollah/a9836f83aab1a3df06ef4a10b67ea962 to your computer and use it in GitHub Desktop.
Save mehdinourollah/a9836f83aab1a3df06ef4a10b67ea962 to your computer and use it in GitHub Desktop.
//usage
<p>{{ testModel }}</p>
<mySelect v-model="testModel" :options="testSelect" />
// declaration
const mySelect = {
props: ["modelValue", "options"],
emits: ["update:modelValue"],
render() {
return (
<>
<select
onChange={(event)=>this.$emit("update:modelValue", event.target.value)}
v-model={this.modelValue}
name="cars"
id="cars"
>
{this.options.map((o) => {
return <option value={o}>{o}</option>;
})}
</select>
</>
);
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment