提交
This commit is contained in:
36
甲情_甲意/miniprogram/pages/index/index.js
Normal file
36
甲情_甲意/miniprogram/pages/index/index.js
Normal file
@ -0,0 +1,36 @@
|
||||
Page({
|
||||
data:{
|
||||
data:null
|
||||
},
|
||||
async onLoad(){
|
||||
//初始化 context ,这里代码可以抽象为公共代码
|
||||
const context = await my.cloud.createCloudContext({
|
||||
env: 'env-00jx467y0ti7' //修改为自己的环境 ID
|
||||
});
|
||||
|
||||
await context.init();
|
||||
var self = this;
|
||||
my.showLoading({
|
||||
content: '加载中...',
|
||||
delay: '100',
|
||||
});
|
||||
console.log(my.fncontext);
|
||||
context.callFunction({
|
||||
name:'helloworld',
|
||||
success:function(res){
|
||||
my.hideLoading();
|
||||
console.log(res);
|
||||
self.setData({
|
||||
data:res.result.message
|
||||
});
|
||||
},
|
||||
fail:function(erro){
|
||||
my.hideLoading();
|
||||
console.log(erro);
|
||||
self.setData({
|
||||
data:null
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user