[Vue warn]: Computed property “userInfo“ was assigned to but it has no setter.
[Vue warn]: Computed property "userInfo" was assigned to but it has no setter.一、报错信息二、报错代码三、报错原因四、解决办法一、报错信息[Vue warn]: Computed property “userInfo” was assigned to but it has no setter.二、报错代码computed
·
[Vue warn]: Computed property "userInfo" was assigned to but it has no setter.
一、报错信息
[Vue warn]: Computed property “userInfo” was assigned to but it has no setter.
二、报错代码
computed: {
...mapState({
userInfo: state => state.userInfo
})
},
methods: {
...mapActions(['setUserInfo']),
getPersonInfo () {
this.$axios.get('userinfo/').then(res => {
if (res.data.flag) {
this.userInfo = res.data.data // 这句代码应该删除掉
this.setUserInfo(res.data.data)
}
})
}
}
三、报错原因
对在computed中值进行了赋值操作
四、解决办法
删除掉对computed中的值的赋值操作
this.userInfo = res.data.data // 这句代码应该删除掉
更多推荐
已为社区贡献14条内容
所有评论(0)