Created
March 13, 2022 22:59
-
-
Save natanfeitosa/6305bf7c8abfb17546d7b38a0e7962a8 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
<!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