Index.wxml是页面文件,里面的内容参考
https://developers.weixin.qq.com/miniprogram/dev/component/
可以在page文件夹下创建自己的页面文件,bindtap是点击事件as是点击事件的名字
事件在index.js进行配置,我这里配置的是一个点击后弹框的事件


关于跳转页面,在创建的点击事件中使用wx.redirectTo方法跳转
wx.navigateTo: 保留当前页面,跳转到应用内的某个页面
wx.redirectTo: 关闭当前页面,跳转到应用内的某个页面
wx.switchTab: 跳转到tabBar页面(在app.json中注册过的tabBar页面)
wx.reLanch:关闭所有页面,打开到应用内的某个页面。

关于连接服务器
选择详情 勾选下面的不校验合法域名

在js方法中调用外部服务接口
zuye: function (event){
console.log(event)
var id = event.currentTarget.id;
if(id == "zl"){ 调用接口
wx.request({
url:'http://172.20.10.5:8080/do',
header: {
'content-type': 'application/json' // 默认值
},
success(res) {
wx.showModal({
title: '提示', content: “”
});
console.log(res.data); //获取数据
}
})
} else if (id == "rb"){ //跳转页面
wx.redirectTo({
url: '../ER/csss',
});
}
}
来源:https://www.cnblogs.com/zengshuang233/p/12574257.html