123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- const dateServ = require('../../../utils/date')
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- comments:{
- type:Array,
- default: []
- },
- title: {
- type:String,
- default: '评价列表'
-
- },
- showMore: {
- type:Boolean,
- default: false
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- },
- /**
- * 组件的方法列表
- */
- methods: {
- more(){
- this.triggerEvent('more')
- },
- preview(event){
- console.log(event);
- let image = event.currentTarget.dataset.image
- let comment = event.currentTarget.dataset.item
- wx.previewImage({
- current: image,
- urls: comment.images,
- success: function(res) {
- console.log(res)
- }
- })
- }
- },
- lifetimes: {
- async created() {},
- async attached() {// 在组件实例进入页面节点树时执行
- // console.log(this.comments);
- // let isarr = Array.isArray(this.comments)
- // if(!isarr){
- // this.comments = [this.comments]
- // }
- // console.log(this.comments);
- },
- moved() {},
- detached() {
- },
- ready: function () {// 在组件在视图层布局完成后执行
- // console.log(this.data);
- // this.data.comments.forEach(comment =>{
- // console.log(typeof comment.updatedAt);
- // if(typeof comment.updatedAt == 'date'){
- // return comment.updatedAt = dateServ.formatTime(comment.updatedAt,'YY-mm-dd hh:mm:ss')
- // }
- // return comment.updatedAt
- // })
- // this.setData({
- // comments:this.data.comments
- // })
- },
- },
- })
|