- 为什么不显示<swiper>中的图片?
按照官方的Demo直接copy的,我只是加了个wx:key,不加就报错,加了还是不显示图片,why? 1,控制台没有报错; 2,浏览器中可以访问到图片; <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> <block wx:for="{{imgUrls}}" wx:key="imgUrlId"> <swiper-item> <image src="{{item}}" class="slide-image" width="355" height="150"/> swiper-item> block> swiper> [代码]Page({[代码][代码]data: {[代码][代码]imgUrls: [[代码][代码]'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'[代码][代码],[代码][代码]'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg'[代码][代码],[代码][代码]'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'[代码][代码]],[代码][代码]indicatorDots: [代码][代码]false[代码][代码],[代码][代码]autoplay: [代码][代码]false[代码][代码],[代码][代码]interval: 5000,[代码][代码]duration: 1000[代码][代码]},[代码][代码]})[代码]
2018-02-05 - 新手问题,如何显示当前经纬度在<text>
我想把wx.getLocation获得的经纬度填在<text class="log-item">{{address}}</text>里面, 在回调函数中this.setData({ address: addr})这样写诗错的,请指正,该如何写? <view class="container log-list"> <text class="log-item">{{address}}</text> </view> [代码]Page({[代码][代码] [代码] [代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码]() {[代码][代码] [代码] [代码] [代码][代码]wx.getLocation({[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]var[代码] [代码]latitude = res.latitude [代码][代码]// 经度[代码][代码] [代码][代码]var[代码] [代码]longitude = res.longitude [代码][代码]// 纬度[代码][代码] [代码][代码]var[代码] [代码]addr = [代码][代码]"latitude="[代码] [代码]+ latitude + [代码][代码]",longitude"[代码] [代码]+ longitude[代码][代码] [代码][代码]console.log(addr)[代码][代码] [代码][代码]//这里出错了,应该是this的问题,但如何表达呢?[代码][代码] [代码][代码]this[代码][代码].setData({ address: addr})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]}[代码]
2018-02-01