Last active
August 24, 2022 12:39
-
-
Save letswritetw/4cd5c6d2296871a2205cca010a62a4b7 to your computer and use it in GitHub Desktop.
vue-composition-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
<template> | |
<div> | |
<p ref="msg"></p> | |
<button type="button" | |
@click="changeMsg">click me</button> | |
</div> | |
</template> | |
<script> | |
import { ref } from 'vue' | |
export default { | |
name: 'HelloWorld', | |
setup() { | |
const msg = ref(null); | |
const changeMsg = () => { | |
msg.value.classList.add('lalala'); | |
msg.value.textContent = 'Hello World' | |
} | |
return { msg, changeMsg } | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment