// 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); let Y = date.getFullYear() + '-'; let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1 ) : date.getMonth() +1 ) + '-'; let D = date.getDate() + ' '; let h = date.getHours() + ':'; let m = date.getMinutes(); let hb = (redData.hb / 100).toFixed(2); let string = Y+M+D+h+m + ' ' + `红包+ ${hb}`; this.titltRicheText.string = `${string}`; }, // update (dt) {}, });