[Vuejs]-How to specify name and componetes in <script setup> scope

0👍

You can just add one more script tag and specify component’s name there.

Just like this:

<script>
export default {
  name: "MyComponentName",
};
</script>

<script setup>
import HelloWorld from './components/HelloWorld.vue'
import {defineProps} from 'vue'

const props = defineProps(['foo','greetingMessage'])

name: 'App'
components: {
  HelloWorld
}

console.log("props:",props)
console.log("props.foo:",props.foo)
console.log("props.greetingMessage:",props.greetingMessage)

</script>

Leave a comment