You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
676 B

// app.js
App({
onLaunch() {
this.initcloud();
this.globalData = {
// 用于存储待办记录的集合名称
collection: "todo", // 云数据库中对应的集合
};
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
initcloud() {
// 初始化云开发环境
wx.cloud.init({
traceUser: true,
env: 'test-8get7kse44623236'
});
this.cloud = () => {
return wx.cloud; // 直接返回wx.cloud
}
},
// 获取云数据库实例
async database() {
return (await this.cloud().database());
},
globalData: {
userInfo: null
}
})