https://juejin.cn/post/7123213441875050526
在setup中返回一个方法有两种方式:
方式一:
setup(props, context) {
const handleClick = ()=>{ alert('中国冬奥健儿们加油!') }
return { handleClick }
}
方式二:
setup(props, context) {
function handleClick() {
alert('中国必胜!')
}
return { handleClick }
}