码迷,mamicode.com
首页 > 其他好文 > 详细

列表样式

时间:2017-01-19 01:50:34      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:over   poi   wxs   contain   amp   direction   操作   nav   order   

技术分享

 1.board.wxml

<view class="container">
  <view class="body">
    <scroll-view scroll-y="true" height="100%">
      <block wx:for="{{boards}}">
        <navigator url="../list/list?type={{item.key}}&title={{item.name}}">
          <view class="board">
            <view class="board-info">
              <text class="board-name">{{item.name}}</text>
              <image class="board-img" src="/images/arrowright.png" mode="aspectFill"/>
            </view>
          </view>
        </navigator>
      </block>
    </scroll-view>
  </view>
</view>

2.board.js

// Douban API 操作
const douban = require(‘../../libraries/douban.js‘)

Page({
  data: {
    boards: [
      { key: ‘in_theaters‘, name: ‘正在热映‘ },
      { key: ‘coming_soon‘, name: ‘即将上映‘ },
      { key: ‘top250‘, name: ‘T0P250‘ },
      // { key: ‘weekly‘, name: ‘口碑榜‘ },
      { key: ‘us_box‘, name: ‘北美票房榜‘ },
      // { key: ‘new_movies‘, name: ‘新片榜‘ }
    ],
    movies: [],
    loading: true
  },

  onLoad () {
    douban.find(‘in_theaters‘, 1, 5)
      .then(d => this.setData({ movies: d.subjects, loading: false }))
      .catch(e => {
        console.error(e)
        this.setData({ movies: [], loading: false })
      })
  },
})

3.board.wxss

.container {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 100%;
  font-size: 32rpx;
}
.body {
  padding-left: 30rpx;
  padding-right: 30rpx;
  flex: 1;
  overflow: auto;
}
.board {
  margin-top: 20rpx;
  margin-bottom: 20rpx;
  background-color: #FBF9FE;
  overflow: hidden;
  border-radius: 4rpx;
  cursor: pointer;
}
.board-info {
  display: flex;
  padding: 40rpx;
  align-items: center;
  flex-direction: row;
}
.board-name {
  flex: 1;
}
.board-img {
  width: 32rpx;
  height: 32rpx;
}

  

  

  

列表样式

标签:over   poi   wxs   contain   amp   direction   操作   nav   order   

原文地址:http://www.cnblogs.com/ganchuanpu/p/6298444.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!