Showing
1 changed file
with
19 additions
and
19 deletions
| @@ -152,27 +152,27 @@ Page({ | @@ -152,27 +152,27 @@ Page({ | ||
| 152 | */ | 152 | */ |
| 153 | onShow: function () { | 153 | onShow: function () { |
| 154 | this.selectComponent('#getpos').getPos(); | 154 | this.selectComponent('#getpos').getPos(); |
| 155 | - | ||
| 156 | - this._observer = wx.createIntersectionObserver(this) | ||
| 157 | - this._observer | ||
| 158 | - .relativeTo('.scroll-view') | ||
| 159 | - .observe('.swiper-view', (res) => { | ||
| 160 | - console.log('sv.observe',res) | ||
| 161 | - if(res.intersectionRatio > 0){ | ||
| 162 | - wx.setNavigationBarColor({ | ||
| 163 | - frontColor:'#ffffff', | ||
| 164 | - backgroundColor:'#ffffff', | ||
| 165 | - }) | ||
| 166 | - }else{ | ||
| 167 | - wx.setNavigationBarColor({ | ||
| 168 | - frontColor:'#000000', | ||
| 169 | - backgroundColor:'#ffffff', | 155 | + if(wx.createIntersectionObserver){ |
| 156 | + this._observer = wx.createIntersectionObserver(this) | ||
| 157 | + this._observer | ||
| 158 | + .relativeTo('.scroll-view') | ||
| 159 | + .observe('.swiper-view', (res) => { | ||
| 160 | + if(res.intersectionRatio > 0){ | ||
| 161 | + wx.setNavigationBarColor({ | ||
| 162 | + frontColor:'#ffffff', | ||
| 163 | + backgroundColor:'#ffffff', | ||
| 164 | + }) | ||
| 165 | + }else{ | ||
| 166 | + wx.setNavigationBarColor({ | ||
| 167 | + frontColor:'#000000', | ||
| 168 | + backgroundColor:'#ffffff', | ||
| 169 | + }) | ||
| 170 | + } | ||
| 171 | + this.setData({ | ||
| 172 | + hasNav: res.intersectionRatio == 0 | ||
| 170 | }) | 173 | }) |
| 171 | - } | ||
| 172 | - this.setData({ | ||
| 173 | - hasNav: res.intersectionRatio == 0 | ||
| 174 | }) | 174 | }) |
| 175 | - }) | 175 | + } |
| 176 | }, | 176 | }, |
| 177 | 177 | ||
| 178 | /** | 178 | /** |
-
Please register or login to post a comment