computed: {
canApply: function () {
const { detail } = this
if (detail && detail.create_time) {
console.info('detail', detail.create_time)
const create_time = new Date(detail.create_time.replaceAll('-', '/')).getTime()
if ((Date.now() - create_time) > 1000 * 60 * 60 * 24 * 7) {
return false
}
return true
}
return false
}
}
s上面这段代码报replaceAll is not function,将const create_time = new Date(detail.create_time.replaceAll('-', '/')).getTime()换成
const create_time = new Date(detail.create_time.replace(/-/g, '/')).getTime()就可以了,小程序基础库2.14.4,
是不是小程序不支持字符串的replaceAll方法啊
如果报这个错误【replaceAll is not function】,就说明小程序不支持replaceAll这个方法