Is it possible to define the name
and components
in a <script setup>
mode? In a <script>
mode, you can do something like this:
export default {
name: 'App',
props: ['foo', 'greetingMessage'],
components: {
HelloWorld
},
}
How can you achieve the same in <script setup>
mode?
App.vue:
<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<span>greetingMessage:{{ greetingMessage }}</span>
</template>
<script setup>
import HelloWorld from './components/HelloWorld.vue'
import {defineProps} from 'vue'
const props = defineProps(['foo','greetingMessage'])
// How do we set the name and components here?
// name: 'App'
// components: {
// HelloWorld
// }
console.log("props:",props)
console.log("props.foo:",props.foo)
console.log("props.greetingMessage:",props.greetingMessage)
</script>