首页 > 代码库 > 列表样式
列表样式
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="http://www.mamicode.com/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 }, onl oad () { 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; }
列表样式
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。