子组件
const emit = defineEmits(['getcode']);
emit('getcode', 3);//可以把他放到函数中,一触发父组件就能收到
父组件
//组件
<yikoujia @getcode="getcode"></yikoujia>
const getcode = async (it) => {
console.log(it);
}
父传子
父组件
<follow :activeIndex="activeIndex"></follow>
子组件
const props = defineProps(['activeIndex']);
onMounted(() => {
console.log(props);
});