[TOC]
## movie-more.js
```
// pages/movie/movie-more/movie-more.js
const app = getApp();
const douban = app.globalData.doubanUrl;
import utils from "../../../utils/utils"
var star = utils.star;
var http = utils.http;
Page({
data:{
isEmpty:true,
start:0
},
onLoad: function (options) {
var type = options.type;
var title = options.title;
// console.log(title)
var count = "?start=0&count=20";
var url = douban + type + count;
http(url, this.handleData)
wx.setNavigationBarTitle({
title
});
this.setData({
type
})
wx.showLoading({
title: '加載中',
})
},
handleData(res){
var title = res.data.title;
var subjects = res.data.subjects;
var movies = [];
subjects.forEach(ele=>{
var average = ele.rating.average;
var title = ele.title;
var id = ele.id;
if(title.length>6){
title = title.substr(0, 6) + '...';
}
var stars = star(ele.rating.stars);
var imgUrl = ele.images.small;
var temp = {
average,
title,
stars,
imgUrl,
id
}
movies.push(temp);
})
if(this.data.isEmpty){
this.setData({
movies,
title,
isEmpty:false
})
}else{
this.setData({
movies:this.data.movies.concat(movies)
})
}
wx.hideLoading()
},
onReachBottom(){
this.data.start+=20
var start = this.data.start
var type = this.data.type
var url = `${douban}${type}?start=${start}&count=20`
http(url,this.handleData)
wx.showLoading({
title: '加載中',
})
},
onClick(event){
var id = event.currentTarget.dataset.id;
console.log(id)
wx.navigateTo({
url: '/pages/web-page/web-page?id='+id,
})
}
})
```
## wxss和wxml
```
<import src="../movie-item/movie-item"></import>
<view class='movie-more'>
<block wx:for="{{movies}}" wx:key="index">
<template is="movieItem" data="{{...item}}" ></template>
</block>
</view>
/* pages/movie/movie-more/movie-more.wxss */
@import '../movie-grid/movie-grid-template';
.movie-more{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 20rpx;
font-size: 30rpx;
}
```
- 開發環境及接口
- 0.豆瓣接口
- 1.開發環境配置
- 2.一些相關文檔
- 小程序實例效果
- 第0節、TodoList
- 第一節、豆瓣相關
- 1、tabBar的配置及導航加標題
- 2、數據加載及下拉加載
- 3、加載相關
- 4、輪播
- 5、星星評分
- 第二節、音樂播放相關
- 1.點擊收藏分享
- 2.音樂播放
- 初始版
- 組件版
- 組件加強版
- 3.點贊
- 點贊初級版
- 點贊第二版
- 5.左右按鈕
- 6.緩存
- 第三節、補充
- 地圖
- 點擊拍照換圖
- 掃一掃
- 小程序語法
- 第一節 、HTTP的封裝
- 0.http請求
- 1.function封裝
- 2.class封裝http
- 3.promise封裝
- 4.config地址
- 第二節、組件
- 2.組件單獨設置樣式
- 3.一些有意義的標簽
- 4.behavior
- 5.SLOT
- 6.左右按鈕
- 5.點贊組件
- 6.用戶授權
- 圖片按鈕 如分享
- 第三節、api
- 1.頁面跳轉
- 獲取input里的值
- 1.添加評論
- 2.搜索框
- 3. 獲取input里的值
- 2.設置緩存
- 3.模態框,彈出框
- 4.分享showActionSheet
- 5.定義全局的數據
- 2. 基礎知識
- 1.setData
- 2.文件結構
- 3.wxml語法
- 第一節 數據綁定
- 第二節 列表渲染
- 第三節 條件渲染
- 第四節 模板
- 第五節 事件
- 第六節 引用
- 4.wxs
- 1.文本縮進問題
- 5.小程序中遇到的wxss 問題
- 1.width100%越界問題
- 廢棄的文件
- 一個完整的小程序
- 1.啟動頁面
- 2.yuedu輪播+封裝及數據調用
- yuedu的詳情頁
- 3.電影
- movie-more
- web-view