<wxs module="wxs"> function formatDate(time) { console.log(time); var t = getDate(time); var tf = function(i){return (i < 10 ? '0' : '') + i}; var year = t.getFullYear(); var month = tf(t.getMonth() + 1); var day = tf(t.getDate()); var hour = tf(t.getHours()); var minute = tf(t.getMinutes()); return month + '-' + day + ' ' + hour + ':' + minute; } module.exports.formatDate = formatDate; </wxs> <view class='my-concern'> <view class="concern-center"> <view class='concern-info' wx:for="{{ fanList }}" wx:key="{{ index }}" bindtap='toUserDetails' data-uid='{{ item.user.uid }}' data-fanId='{{ item.fans.fanId }}'> <view class='avatar-box'> <image class='avatar-image' src="{{ item.user.avatar }}" /> </view> <view class="avatar-name"> <text class="nickName">{{ item.user.wechatName }}</text> <text class="time">{{ wxs.formatDate(item.fans.gmtCreated) }}</text> </view> <view class="avatar-follow" wx:if='{{ item.isEachOther }}'> <view class='avatar-img'> <image class='avatar-images' src="../../../static/image/concernback.png" /> </view> <view class="follow-status">相互关注</view> </view> <view class="avatar-follow" wx:elif='{{ item.followBack === item.followBack || item.isEachOther }}'> <view class='avatar-img'> <image class='avatar-images' src="../../../static/image/concerned.png" /> </view> <view class="follow-status">已关注</view> </view> </view> </view> </view>