Created
June 17, 2021 17:28
-
-
Save guillaumeduhan/106503e2876b2ebbed6ae57634532621 to your computer and use it in GitHub Desktop.
Vue 3: props
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>{{ msg }}</p> | |
</div> | |
</template> | |
<script> | |
import { reactive, toRefs } from "vue"; | |
export default { | |
props: { | |
textFromProps: String | |
}, | |
setup (props) { | |
console.log(props) | |
const data = reactive({ | |
msg: `Hello ${props.textFromProps}` | |
}); | |
return { | |
...toRefs(data) | |
}; | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment