收藏
回答

wxs getDate

控制台输出

function nv_getDate(nv_date){if (nv_date === undefined)return(nv_date);;return(nv_date.nv_split(" ")[(0)])}

function 2017-7-1 string 

返回结果为string

回答关注问题邀请回答
收藏

2 个回答

  • Instone
    Instone
    2023-05-01

    NaN是解析的值

    js中create_time的值

    <!--pages/video/video.wxml-->
    <view class="video-list" wx:for="{{movieList}}" wx:key="user">
        <view class="video-title">{{item.title}} </view>
        <view class="video-time">{{formatData(item.create_time)}} </view>
        <video src="{{item.src}}" object-fit="fill"/>
    </view>
    <wxs module="formatData">
        module.exports=function(timestamp){
            var date=getDate(timestamp)
            var y=date.getFullYear()
            var m=date.getMonth()
            var d=date.getDate()
            var h=date.getHours()
            var i=date.getMinutes()
            var s=date.getSeconds()
            return y+'-'+m+'-'+d+' '+h+'-'+i+'-'+s
        }
    </wxs>
    
    2023-05-01
    有用
    回复 1
    • Instone
      Instone
      2023-05-01
      这些方法在开发文档里是有的,为啥是解析出来是NaN
      2023-05-01
      回复
  • 夕阳西下?
    夕阳西下?
    2020-08-20

    不明白!

    2020-08-20
    有用
    回复 6
    查看更多(1)
登录 后发表内容
问题标签