Skip to content

Instantly share code, notes, and snippets.

@guillaumeduhan
Created June 17, 2021 17:28
Show Gist options
  • Save guillaumeduhan/106503e2876b2ebbed6ae57634532621 to your computer and use it in GitHub Desktop.
Save guillaumeduhan/106503e2876b2ebbed6ae57634532621 to your computer and use it in GitHub Desktop.
Vue 3: props
<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