- 微信小程序云开发模拟器上传的图片手机无法看见。手机上传的模拟器也看不见。发布出去用户上传也看不见?
doUpload: function () { // 选择图片 let that = this; wx.chooseImage({ count: 1, sizeType: ['compressed'], sourceType: ['album', 'camera'], success: function (res) { wx.showLoading({ title: '上传中', }) const filePath = res.tempFilePaths[0] // 上传图片 const cloudPath = 'my-image' + filePath.match(/\.[^.]+?$/)[0] wx.cloud.uploadFile({ cloudPath, filePath, success: res => { console.log('[上传文件] 成功:', res) app.globalData.fileID = res.fileID app.globalData.cloudPath = cloudPath app.globalData.imagePath = filePath that.data.imagePath.push(filePath) that.setData({ imagePath: that.data.imagePath }) }, fail: e => { console.error('[上传文件] 失败:', e) wx.showToast({ icon: 'none', title: '上传失败', }) }, complete: () => { wx.hideLoading() } }) }, fail: e => { console.error(e) } }) },
2020-07-31 - scroll-view中的bindscroll在组件里面无法触发?
<view style="margin-bottom: 140rpx;"> <swiper wx:if="{{banner_list.length>0}}" class="coffee-bgimg" indicator-dots="true" autoplay="true" interval="3000" duration="1000" circular> <swiper-item wx:key="id" wx:for="{{banner_list}}" wx:key="index" data-item="{{item}}"> <image src="{{item.bannerUrl}}"></image> </swiper-item> </swiper> <scroll-view style="height:100%;width:100%;" scroll-y="true" bindscroll="scroll"> <van-tabs active="{{ active }}" bind:scroll="onScroll" bind:click="onClick" color="#1296db" class="{{scrollTop > 360 ? 'stickyClass' : ''}}"> <van-tab title="{{item.name}}" data-id="{{item.id}}" wx:for="{{tabList}}" wx:key="index" name="{{item.id}}"></van-tab>Ï </van-tabs> <view class="coffee-item" wx:for="{{goodsList}}" wx:key="index"> <image class="coffee-img" src="{{item.mainImage}}"></image> <view class="coffee-info"> <view class="coffee-name">{{item.name}}</view> <view class="coffee-price"> <view>¥{{item.price/100}}</view> <view>已售:{{item.volume}}</view> </view> </view> </view> </scroll-view> </view> scroll(e) { console.log(e); },
2020-07-29