相关代码:template:<button class="login" @click="login">登录</button>export default {
data() {
return {};
},
computed: {
...mapState(["loginStore"])
},
methods: {
login() {
alert("e");
}
}
};错误信息如下图:
2 回答

慕婉清6462132
TA贡献1804条经验 获得超2个赞
就 methods 与 click 事件绑定都是没有问题的
另外...mapState 官网例子是如下使用的,不知道你的用法能否正常使用
computed: { // 使用对象展开运算符将此对象混入到外部对象中 ...mapState({ // ... }) }
添加回答
举报
0/150
提交
取消