Skip to content

Instantly share code, notes, and snippets.

@letswritetw
Last active August 24, 2022 12:39
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 letswritetw/4cd5c6d2296871a2205cca010a62a4b7 to your computer and use it in GitHub Desktop.
Save letswritetw/4cd5c6d2296871a2205cca010a62a4b7 to your computer and use it in GitHub Desktop.
vue-composition-api
<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