defineProps defineProps 用于声明组件接收的属性(props)。通过这个宏,可以指定组件期望从父组件接收哪些属性,以及它们的类型和默认值。这有助于提高代码的可读性和可维护性,同时减少错误。 使用示例: import { defineProps } from 'vue' const props = defineProps({ name: String, age: Number,