举个🌰
import { effect, ref, type VNode } from 'vue'
type Props = {
name: string
header: (count: number) => VNode
children?: VNode
}
type Handler = {
addCount: () => void
}
function ChildComp(props: Props) {
const innerCount = ref(0)
defineExpose({
addCount() {
innerCount.value++
},
})
if(!props.children) return no children
return (
{props.header(innerCount.value)}
innerCount.value++}>
{props.name} count: {innerCount.value}
{props.children}
)
}
项目目前就 preview 版本,还不算稳定
https://github.com/apades/make-vue-coding-more-like-react

