工具版本:Nightly 1.03.2005252
操作系统:win10
控制台报错如下:
RuntimeError: cannot read property 'getTime' (from line 2, col 12 to line 2, col 19)
1 | let t = new Date()
> 2 | let tt = t.getTime()
| ^^^^^^^
3 | db.collection('water')
4 | .add({
5 | data: {
工具版本:Nightly 1.03.2005252
操作系统:win10
控制台报错如下:
RuntimeError: cannot read property 'getTime' (from line 2, col 12 to line 2, col 19)
1 | let t = new Date()
> 2 | let tt = t.getTime()
| ^^^^^^^
3 | db.collection('water')
4 | .add({
5 | data: {
2 个回答
你看看你Date对象是不是被覆盖了.
你要是云数据库的话,你得用数据库的获取当前时间方法.
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/aggregate/AggregateCommand.year.html
参考下这里面的
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/Database.serverDate.html
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/dbscript.html
Date.now()
5 | shopid: 'ouGof0e1GZMOxta5',
6 | kind: 'new',
> 7 | starttime: Date.now(),
| ^^^
8 | avatarUrl: '1321',
9 | nickName: '风满楼'
10 | }