1.props
父组件传参不变,子组件接收:
<p>{{ props.abc }}</p> <p>{{ props.msg }}</p>const props = defineProps({ msg: { type: String, required: true }, abc: { type: Number, required: true } })
2.emit
父组件接收不变,子组件传参如下:
const emit = defineEmits(['increment']) const count = ref(100) const increment = () => { count.value++ emit('increment', count.value) }
标签:count,const,vue3,父子,increment,props,组件,emit From: https://www.cnblogs.com/ssszjh/p/16789374.html