- 聚合数据新闻头条时,获取新闻详情失败,原因是uniquekey格式错误?
[图片] [图片][图片] [图片]
2021-04-01 - 获取不到点击事件的index?
[图片] [图片] [图片] [图片]
2021-03-22 - 点击图片预览Cannot read property '0' of undef..?
找不到是啥原因了,还请各位赐教 WXML内代码如下:windex是获取点击的消息的下标,index是获取点击消息下对应图片的下标 <view class="weibo-group" wx:for="{{weibos}}" wx:for-item="weibo" wx:for-index="windex"> <!-- 一张图片的情况 --> <view wx:if="{{weibo.weibo.images.length===1}}" class="image-list-group"> <image src="{{weibo.weibo.images}}" wx:for-item="image" src="{{image}}" bindtap="onImageTap" data-index="0" data-weibo="{{windex}}"> </image> </view> <!-- 两张或四张图片情况 --> <view wx:elif="{{weibo.weibo.images.length===2||weibo.images.length===4}}" class="image-list-group"> <image wx:for="{{weibo.weibo.images}}" wx:for-item="image" src="{{image}}" bindtap="onImageTap" data-index="{{index}}" data-weibo="{{windex}}"> </image> </view> JS内的代码如下: onImageTap:function(event){ console.log(event) const dataset = event.target.dataset; const weiboIndex = dataset.weibo; const imageIndex = dataset.index; const images = this.data.weibos[weiboIndex].images; const current =images[imageIndex]; wx.previewImage({ urls: images, current:current }) }, 打印event也能有内容,但是在点击图片进行预览的时候就出问题了 event打印内容如下: [图片] 报错信息如下: [图片]
2021-02-06 - 在WXML添加真实数据出问题?
在WXML文件里添加真实数据以后,模拟器显示不出来。打印了数据,数据是存在的但是无法调用。 调试器内打印出来的数据(数据是从云数据库获取的)如下: [图片] 代码如下: <wxs src="../../utils/util.wxs" module="util" /> <view class="container"> <view class="weibo-group" wx:for="{{weibos}}" wx:for-item="weibo"> <view class="user-group"> <image class="avatar" src="{{weibo.author.avatarUrl}}"> </image> <view class="right-info"> <view class="username">{{weibo.author.nickName}}</view> <view class="detail-info"> <view class="time">{{util.timeFormat(weibo.create_time)}}</view> <view class="from">来自{{weibo.device}}</view> </view> </view> </view> <view class="weibo-content-group"> <view class="content">{{weibo.content}}</view> <bolock wx:if="{{weibo.images.length > 0}}"> <!-- 一张图片的情况 --> <view wx:if="{{weibo.images.length===1}}" class="image-list-group"> <image src="{{weibo.images}}" mode="aspectFill" style="width:100%; max-height:400rpx;"> </image> </view> <!-- 两张或四张图片情况 --> <view wx:elif="{{weibo.images.length===2||weibo.images.length===4}}" class="image-list-group"> <image wx:for="{{weibo.images}}" wx:for-item="image" src="{{image}}" mode="aspectFill" style="width:{{twoImageSize}}px;height:{{twoImageSize}}px"> </image> </view> <!-- 3、5、6、7、8、9张图片的情况 --> <view wx:else class="image-list-group"> <image wx:for="{{weibo.images}}" wx:for-item="image" src="{{image}}" mode="aspectFill" style="width:{{threeImageSize}}px;height:{{threeImageSize}}px"> </image> </view> </bolock> <!-- 上传视频的情况 --> <block wx:if="{{weibo.video}}"> <view class="image-list-group"> <video src="{{weibo.video}}"></video> </view> </block> </view> 模拟器显示: [图片]
2021-02-05 - 云函数报错Cannot read property 'startsWith' of undefid?
根据网上的视频在做文字违规检测,代码写好以后在云函数日志里面报错了Cannot read property 'startsWith' of undefined。在网上也找不到有效的解决办法。小白一枚,还请大佬们指教 云函数内的代码如下: const TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APPID+ "&secret=" + APPSECRET const CHECK_URL = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" // 云函数入口函数 exports.main = async (event, context) => { const content = event.content; const author = event.author; const location = event.location; const images = event.images; // 文字内容检测 const tokenResp =await got.post(TOKEN_URL); const tokenBody = JSON.parse(tokenResp.body); const token = tokenBody.access_token; const checkResp = await got.post(CHECK_URL+token,{ body:JSON.stringify({ content:content, location:location, author:author }) }); const checkBody = JSON.parse(checkResp.body); console.log(checkBody); const errcode = checkBody.errcode; if(errcode == 0){ return await db.collection("weibo").add({ data:{ content:content, location:location, author:author } }) } else{ return{"errcode":1,"errmsg":"您的文字内容有风险!请修改后发布!"} } }
2021-02-04 - msgCheck和token报错:The `GET` method cannot be used?
[图片] [图片] [图片]
2021-02-01 - 编写跳转页面时,options获取的id总是undefine,怎么办?
[图片] [图片] [图片]
2021-01-17