小程序调用云函数

小程序端
app.js
// 云环境初始化
wx.cloud.init({
env: "xylz-9nirz",
traceUser: true
})
index.js
// 获取数据库数据
const db = wx.cloud.database();
db.collection(‘article‘).get().then(res=>{
console.log(res)
})
// 云函数编写
目录结构
│  project.config.json
│
├─Client
│  │  app.js
│  │  app.json
│  │  app.wxss
│  │  sitemap.json
│  │
│  ├─components
│  │  └─goods
│  │          goods.js
│  │          goods.json
│  │          goods.wxml
│  │          goods.wxss
│  │
│  └─pages
│      └─index
│              index.js
│              index.json
│              index.wxml
│              index.wxss
│
└─Cloud
project.config.json 项目配置文件
{
"miniprogramRoot": "Client",
"cloudfunctionRoot": "Cloud"
}

小程序调用云函数

原文:https://www.cnblogs.com/gmbjzg/p/14619298.html

以上是小程序调用云函数的全部内容。
THE END
分享
二维码
)">
< <上一篇
)">
下一篇>>