试过了,报了一连串的警告: [图片]
如何把pages中网络图片传值给components中,在pages页面中使用获取到不同的图片?在components中封装了一个组件,如果我要把这个组件在多个地方使用,但是图片传是值不一样,那么要如何设定 如图:第一张图获取到的图片地址是:cover.url,而第二个获取到的图片地址是:pic.large [图片] [图片] 我一开始用下面代码不起作用。那么这个src的值要怎么设定,才能够在pages页面中传入获取到的不同的图片 components中js 代码: imagePath:{ type:Array, value:"" } components中wxml代码: <view class="thumbnail-group"> <image class="thumbnail" src="{{imagePath}}" /> </view> pages页面中的代码: <indexmodule title="电影" items="{{movies}}" imagePath="{{item.cover.url}}"></indexmodule>
2023-09-28[图片]这个是学习视频的教程 [图片]这个是做好的页面,点击时跳转到另一个页面 [图片]这个就是点击之后,调试器显示的,这行代码就是从这里面得到。情况就是这么个情况
已声明datawet,但从未读取其值,这是什么问题?如下面的代码,写了一个跳转的代码,我之前也是这样写,怎么就从来没有遇到过如图所示的问题,是不是小程序又改了? ts代码: onshijian(e){ console.log(e); var dataset=e.currentTarget.dataset; wx.navigateTo({ url:'/pages/abc/abc' }) }, 问题如图: [图片]
2023-05-09我在下拉菜单中,三角和字体要排一行,水平排列也没有作用,
请技术人员解答,flex-direction: row 无效[代码]下面是官方的例子:为什么[代码]flex-direction: row 也不能横排了呢?搞了一个星期了,都不能解决。请技术人员解答! [代码]<view class="section">[代码] [代码] <view class="section__title">flex-direction: rowview> <view class="flex-wrp" style="flex-direction:row;"> <view class="flex-item bc_green">1view> <view class="flex-item bc_red">2view> <view class="flex-item bc_blue">3view> view>view><view class="section"> <view class="section__title">flex-direction: columnview> <view class="flex-wrp" style="height: 300px;flex-direction:column;"> <view class="flex-item bc_green">1view> <view class="flex-item bc_red">2view> <view class="flex-item bc_blue">3view> view>view>[代码][图片] 都提问好几天了,怎么就没有人能帮解决一下呢?我很急。https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=d86e12ed81a4ea105df5eb3dcb051093&token=544777948&lang=zh_CN
2022-08-23同问
求reportRealtimeAction:fail not support 造成原因?解决方式?[图片]
2022-08-07[图片]这个是云控制台数据库的截图
求助,百度了N次,说db.serverDate()创建的时间。无法在WXML中解析?wxs时间格式化页面时间是正常的,格式化服务器的时间就显示NaN,百度上查很多,有的说,db.serverDate()创建的时间,在wxml中无法解析。怎么解决? [图片][图片][图片][图片] wxs代码: var timeFormat = function(time){ console.log(time); var date = getDate(time); console.log(date); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if(timestamp < 60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60 * 60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60 * 60 && timestamp < 60 * 60 * 24){ var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; }else if(timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30){ var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; } module.exports={ timeFormat:timeFormat, }
2022-08-05https://developers.weixin.qq.com/s/c2B9eemp7OB5
时间格式化模拟器显示NaN,console.log(time)时,显示undefiled,怎么解决?图片 [图片] js代码 // pages/index/index.js Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var time=new Date(2022,10,29,10,39,23).toLocaleString(); this.setData({ time:time }) }, wxml代码 <!--pages/index/index.wxml--> <wxs src="/pages/utils/util.wxs" module="utils" /> <view>{{utils.timeFormat(time)}}</view> wxs代码 var timeFormat = function(time){ // console.log(time); var date = getDate(time); console.log(date); var date_seconds = date.getTime() / 1000;//当前执行的秒数 var now = getDate(); var now_seconds = now.getTime() / 1000;//当前时间的秒数 var timestamp = now_seconds-date_seconds;//时间戳 var timeStr = "";//时间的字符串 if(timestamp<60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60*60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60*60 && timestamp < 60*60*24){ var hours = parseInt(timestamp / 60 / 60 ); timeStr = hours + "小时前"; }else if(timestamp >= 60*60*24 && timestamp < 60*60*24*30){ var days = parseInt(timestamp/60/60/24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year+"/"+month+"/"+day+""+hour+":"+minute; } return timeStr; } module.exports={ timeFormat:timeFormat } console.log(time)时, [图片] console.log(date)时, [图片] 这个是什么问题,求大师们帮忙解答下,谢谢
2022-08-03[图片]
获取真实的数据,时间显示NaN/NaN/NaN NaN:NaN,求大师帮忙 ?[图片] console.log(time)显示信息如下 [图片] wxs代码: var timeFormat = function(time){ // console.log(time); var date = getDate(time); console.log(date); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if(timestamp < 60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60 * 60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60 * 60 && timestamp < 60 * 60 * 24){ var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; }else if(timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30){ var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; } module.exports={ timeFormat:timeFormat, } wxml代码 <!--index.wxml--> <wxs src="../../utils/util.wxs" module="util"/> <view class="container"> <view class="weibo-group" wx:for="{{weibos}}" wx:key="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.cretae_time)}}</view> <view class="from">来自{{weibo.device}}</view> </view> </view> </view> 云函数代码: return await db.collection("weibo").add({ data:{ content:content, location:location, author:author, images:images, video:video, cretae_time:db.serverDate(), device:device } })
2022-08-01同样的问题,怎么解决的
wxs格式化出现的都是NAN,这是为什么?附代码这是wxml,content是测试数据库信息能否读出来 <wxs src="../../utils/util.wxs" module="util"></wxs> <view> {{util.msg}} </view> <view wx:for="{{txt_content}}"> <view class="time">{{util.timeFormat(item.creat_time)}}</view> <view class="text">{{item.content}}</view> </view> 这是util.wxs代码,msg测试是否能从wxs传过来 var timeFormat = function (time) { var date = getDate(time); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if (timestamp < 60) { timeStr = "刚刚"; } else if (timestamp >= 60 && timestamp < 60 * 60) { var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; } else if (timestamp >= 60 * 60 && timestamp < 60 * 60 * 24) { var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; } else if (timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30) { var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; } else { var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; } module.exports = { timeFormat: timeFormat } module.exports.msg = "some msg"; 运行结果如图 [图片]有人知道这是怎么回事吗??
2022-07-30同样的问题,怎么解决的?
中国标准时间转化显示错误?time的值是中国标准化时间,但是显示到界面上NaN/NaN/NaN NaN:NaN 打印date显示的是【object Object】 var timeFormat = function (time) { var date = getDate(time); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if (timestamp < 60) { timeStr = "刚刚"; } else if (timestamp >= 60 && timestamp < 60 * 60) { var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; } else if (timestamp >= 60 * 60 && timestamp < 60 * 60 * 24) { var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; } else if (timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30) { var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; } else { var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; }
2022-07-30[图片]打印出来之后有个undefined,不知道这是啥情况
时间格式化怎么显示NaN/NaN/NaNNaN/:NaN?这个问题求解,图片如下 [图片] js代码: // pages/index/index.js Page({ /** * 页面的初始数据 */ data: { day:5 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var time=new Date(2022,6,29,14,39,23).toLocaleString(); this.setData({ time:time }) }, wxml代码 <!--pages/index/index.wxml--> <wxs src="../utils/util.wxs" module="utils" /> <view>{{utils.timeFormat(time)}}</view> wxs代码 var timeFormat = function(time){ var date = getDate(time); var date_seconds = date.getTime() / 1000;//当前执行的秒数 var now = getDate(); var now_seconds = now.getTime() / 1000;//当前时间的秒数 var timestamp = now_seconds-date_seconds;//时间戳 var timeStr = "";//时间的字符串 if(timestamp<60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60*60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60*60 && timestamp < 60*60*24){ var hours = parseInt(timestamp / 60 / 60 ); timeStr = hours + "小时前"; }else if(timestamp >= 60*60*24 && timestamp < 60*60*24*30){ var days = parseInt(timestamp/60/60/24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year+"/"+month+"/"+day+""+hour+":"+minute; } return timeStr; } module.exports={ timeFormat:timeFormat }
2022-07-29