20200928冯佳丽
学习日志
微信小程序
获取接口
案例:
// 练习,从接口中请求到的数据,拿到
  // 电影名/电影时长/出口地
  // wx.request({
  //   url:"豆瓣接口",
  //   method:"get",
  //   header:{
  //     'content-type':'application/x-www-form-urlencoded'
  //   },
  //   success(res){
  //     把请求到的数据保存页面中的movie中
  //     显示到页面中
          // this.setData({})
  //   }
  // })
WXML:
js:
onLoad: function (options) {
wx.request({
 url:"http://api.douban.com/v2/movie/new_movies?apikey=0df993c66c0c636e29ecbb5344252a4a",
 method:"get",
 header:{
 'content-type':'application/x-www-form-urlencoded'
 },
 success: (result) => {
 console.log(result)
 this.setData({
 datas:result.data.subjects
 })
 },
 })
},
设置首页、详情、用户
app.json中建立三个文件后在style"v2"后:
"tabBar":{
"color":"#00f",
"selectedColor": "#0f0",
"list": [{
"pagePath": "pages/index1/index1",
"text": "首页",
"iconPath": "images/shouye.png",
"selectedIconPath": "images/shouye_1.png"
},{
"pagePath": "pages/index2/index2",
"text": "详情",
"iconPath": "images/icon_jishiben-.png",
"selectedIconPath": "images/xiangqing.png"
},{
"pagePath": "pages/index3/index3",
"text": "用户",
"iconPath": "images/yonghu.png",
"selectedIconPath": "images/tubiaozhizuomobanyihuifu-.png"
}]
}
图片路径通过iconfont官网下载。
学习感受
内容很多,慢慢消化,就害怕忘记,主要太多了,记不住。



评论留言