关于v-show绑定函数的问题

来源:18-14 评价列表(3)

Mrliufy

2017-09-09

老师,ratingselect派发的消息在父组件收到了,如下:

events: {

'rating.change'(bool) {

  this.onlyContent === bool;

  console.log('events:'+bool);

  },

'rating.select'(type) {

  this.selectType === type;

  console.log('events:'+type);

  }

}

但v-show绑定的needshow却没重新执行,还是之前默认设置的值,导致评价切换按钮失效,v-show="showRating(rating.rateType,rating.text)"

showRating (type, text) {

 if (this.onlyContent && !text){

 console.log('onlycontent');

 return false;

 }

 if (this.selectType === ALL){

   console.log('selectType'+this.selectType);

   return true;

   }else {

   return type === this.selectType;

   }

},


写回答

1回答

Mrliufy

提问者

2017-09-09

粗心了,问题解决了!

0
1
慕田峪1355289
我也遇到这个问题了,请问你是怎么解决的呢
2019-04-03
共1条回复

Vue.js2.5+cube-ui重构饿了么App(经典再升级)

掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp

9868 学习 · 4162 问题

查看课程