const DWTool = require("../utils/DWTool"); cc.Class({ extends: cc.Component, properties: { titltRicheText: cc.RichText, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, //createTime 获取红包的时间 // 是 [long] 查看hb init(redData) { var date = new Date(redData.createTime); Y = date.getFullYear() + '-'; M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1 ) : date.getMonth() +1 ) + '-'; D = date.getDate() + ' '; h = date.getHours() + ':'; m = date.getMinutes() + ':'; s = date.getSeconds(); let string = Y+M+D+h+m+s + ' ' + `红包+ ${redData.hb}`; this.titltRicheText.string = `string` } // update (dt) {}, });