<view wx:for="{{list}}">
<view>商品:{{item.name}}</view>
</view>
// pages/shujuku/shujuku.js
Page({
data:{
list:[]
},
onLoad() {
console.log('启动啦')
wx.cloud.init({
env:'caull-5ghh6arc9f0f6913'
})
//es6的简介写法
wx.cloud.database().collection('goods') //拿到表。双引号也行
.get().then(res=>{//请求成功
console.log('请求成功',res.data)
this.setData({
list:res.data
})
})
.catch(err=>{//请求失败
console.log('请求失败',err)
})
},
})