我有下一个代码:
HTML:
<p @click="changeForm">Iniciar sesion</p>
JS
export default { name: "Register", props: { changeForm: Function, }, setup() { //How can i call props changeForm here??? } }
如何从JS调用props函数?另一种方法是触发点击我的p元素,这可能吗?
我正在使用vue 3。我已经用this.changeForm和props.changeForm进行了测试,但没有成功。
这个 setup 功能接收 props 作为其第一个论点:
setup
props
export default { name: "Register", props: { changeForm: Function, }, setup(props) { // receive `props` argument props.changeForm(); // use it to access `changeForm` } }