Skip to content

Instantly share code, notes, and snippets.

@natanfeitosa
Created March 13, 2022 22:59
Show Gist options
  • Save natanfeitosa/6305bf7c8abfb17546d7b38a0e7962a8 to your computer and use it in GitHub Desktop.
Save natanfeitosa/6305bf7c8abfb17546d7b38a0e7962a8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="utf-8">
<title>Hello World em Vue3</title>
<script type="text/javascript" src="https://unpkg.com/vue@3"></script>
</head>
<body>
<div id="app"></div>
<script type="text/javascript">
const Saudacao = {
props: ['meuNome'],
setup(props) {
const meuNome = Vue.toRef(props, 'meuNome')
return { meuNome }
},
template: '<h1>Olá {{ meuNome }}</h1>'
}
Vue.createApp({
setup() {
const nome = Vue.ref('')
return {
nome
}
},
components: {
Saudacao
},
template: '<input type="text" v-model="nome"><Saudacao :meuNome="nome" />'
}).mount('#app')
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment