defineProps来接受父组件传来的值
//index.vue
<Menu :active = "active"></Menu>
<NuxtPage :collection="defaultCollection" />
//Menu.vue 接受参数
defineProps({
active:{
type:Boolean,
default:false
},
ckey:{
type: Number
}
})
//在 div 中可直接使用,例如: {{ active }} {{ ckey }}
const props = defineProps({
title: String,
info: String,
author: String,
})
// 等价于以 字符串数组声明 props
//const props = defineProps(['title', 'info', 'author']);
// 如果在setup中使用则直接 props.title
RE: Nuxt开发指南