当前位置:   article > 正文

微信小程序返回上一页刷新组件数据

微信小程序返回上一页刷新组件数据

在父页面的onShow和onHide里面添加一个标志

  1. onShow() {
  2. this.setData({
  3. show:true
  4. })
  5. },
  6. onHide() {
  7. this.setData({
  8. show:false
  9. })
  10. },

 把这个值传给子组件

<importantList slot="importantConcern" flag="{{barSelect}}" flag2="{{show}}" />

 在子组件的properties方法里面进行判断当flag2为true的时候调用刷新函数刷新

  1. properties: {
  2. flag: {
  3. type: String,
  4. observer: function(news) {
  5. if(news==='importantConcern'){
  6. this.getnewTablist(this.data.code)
  7. }
  8. }
  9. },
  10. flag2: {
  11. type: String,
  12. observer: function(news) {
  13. if(news==='true'&&news==='importantConcern'){
  14. this.getnewTablist(this.data.code)
  15. }
  16. }
  17. },
  18. },

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号