js代码如下:
const watch=()=>{
const db = wx.cloud.database()
const watcher = db.collection('goods')
watcher.watch({
onChange: function(snapshot) {
console.log('docs\'s changed events', snapshot.docChanges)
console.log('query result snapshot after the event', snapshot.docs)
console.log('is init data', snapshot.type === 'init')
},
onError: function(err) {
console.error('the watch closed because of error', err)
}
})
//watcher.close()
}
j具体报错如下:
建议自查下代码。