我有下一个代码:
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元素的点击,这可能吗?
我正在使用vue3。我已经用this.changeForm和props.changeForm进行了测试,但是没有运气。
该setup
函数接收props
其第一个参数作为:
export default {
name: "Register",
props: {
changeForm: Function,
},
setup(props) { // receive `props` argument
props.changeForm(); // use it to access `changeForm`
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句