我收到警告:
app.js:87486 Vue警告:避免直接更改道具,因为只要父组件重新渲染,该值就会被覆盖。相反,应使用基于属性值的数据或计算属性。被变异的道具:"likescount“
我的刀锋
<path-like-toggle likescount="{{$path->likeCount}}" isliked="{{$path->canBeunLiked()}}" path="{{$path->slug}}" type="{{$path->type}}" ></path-like-toggle>
Vue代码
props:['isliked','path','type','likescount']
,
methods:{
like () {
axios.post(`/${this.type}/${this.path}/like/`)
this.likingStatus = true;
this.likescount ++;
},
unlike () {
axios.post(`/${this.type}/${this.path}/unlike/`)
this.likingStatus = false;
this.likescount --;
},
}
转载请注明出处:http://www.bizarre-animals.com/article/20230401/1367570.html