Last active
December 23, 2023 11:39
-
-
Save isaacssemugenyi/1770ae982fe30e2b8f1bafe5d0ef3d86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script> | |
import { ref, defineComponent } from 'vue' | |
export default defineComponent({ | |
setup(_, context) { | |
const user = ref('guest') | |
const emitUserChange = () => { | |
context.emit('change-user', user.value); | |
} | |
return { | |
user, | |
emitUserChange | |
} | |
} | |
}) | |
</script> | |
<template> | |
<select v-model="user" @change="emitUserChange"> | |
<option value="admin">Admin</option> | |
<option value="guest">Guest</option> | |
<option value="distiguished">Distiguished</option> | |
</select> | |
<p>{{ user }}</p> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment