const db = wx.cloud.database()
const departmentsCollection = db.collection('departments')
Page({
data: {
departments: []
},
onLoad: function() {
this.getDepartments()
},
getDepartments: function() {
departmentsCollection.get().then(res => {
this.setData({
departments: res.data
})
}).catch(err => {
console.error(err)
})
},
goToDoctorSelection: function(e) {
let departmentCode = e.currentTarget.dataset.code
wx.navigateTo({
url: '/pages/doctorSelection/doctorSelection?departmentCode=' + departmentCode
})
}
})
//doctorSelction
const db = wx.cloud.database()
const departmentsCollection = db.collection('departments')
Page({
data: {
departments: []
},
onLoad: function() {
this.getDepartments()
},
getDepartments: function() {
departmentsCollection.get().then(res => {
this.setData({
departments: res.data
})
}).catch(err => {
console.error(err)
})
},
goToDoctorSelection: function(e) {
let departmentCode = e.currentTarget.dataset.code
wx.navigateTo({
url: '/pages/doctorSelection/doctorSelection?departmentCode=' + departmentCode
})
}
})
点击跳转后未显示界面任何内容
有没有拿到数据,打印一下不就知道了?
getDepartments: function() { departmentsCollection.get().then(res => { console.log(res)//这里看一下有没有,不就行了? this.setData({ departments: res.data }) }).catch(err => { console.error(err) }) },