微信小程序的基本结构
逻辑层(js) | 视图层(wxml、wxss) |
---|---|
行为 | 结构 |
数据 | 渲染 |
路由 | 展示 |
微信小程序提供的常用API
- http请求:
wx.request({
url: 'http://www.imooc.com',
method: 'GET',
header: {},
success: function (res) {
console.log(res.data);
data=res.data;
},
fail: function (res) {
console.log("request failed");
}
})
console.log(data);
},
- 上传文件
wx.uploadFile({
filePath: '../images/lan.jpg',
name: '汽车',
url: '*',
success: {
}
})
- wx.getStorage缓存
testSortge: function () {
//异步请求
wx.setStorage({
key: 'test',
data: 'data',
}),
wx.getStorage({
key: 'test',
success: function(res){
console.log(res.data+"1");
}
})
//同步请求
let data = wx.getStorageSync('test');
console.log(data+"2");
},
- 文件是增删改查
- 文件夹的操作
- 用户数据:头像、昵称公开信息–wx.getUserInfo()
- openid 等敏感数据
- 推送消息
- 运营数据 小程序管理后台–数据分析
- 小程序数据助手
- 基础组件
- 视图容器----view swiper cover-view
- 基础内容–text 、icon、rich-text
- 表单、导航–button、form input
- WeUI-WXSS
- 小程序对接Django
- 本地开发对接
- 小程序只能跟指定的域名进行网络通信
- 小程序必须使用HTTPS发起
- 远端部署测试
- 使用git远端同步代码
- 管理依赖环境
- python版本
- requirements.txt
- pip install -r requirements.xt