支付宝PC端小程序 —— 自定义表格
先看下官方文档
链接贴上:https://miniapp.open.taobao.com/docV3.htm?docId=117327&docType=1
下图为table组件Api
表格每行的数据,都是根据slot-scope 这个Api 来渲染的,下图复杂需求,直接上代码
<table dataSource="{{datasource}}" mode='multiple'>
<table-column title="宝贝" dataIndex="goods" resizable width='{{goodsWidth.id}}'>
<view slot-scope="x" class='goods'> //如果需要在一个单元格中自由布局,需要将slot-scope包裹在最外层
<image src='{{x.record.goodsInfo.img}}' class='goodsImg' />
<view class='right'>
<view class='describe'>{{x.record.goodsInfo.describe}}</view>
<view>编码:{{x.record.goodsInfo.code}}</view>
<view>简称:{{x.record.goodsInfo.shortName}}</view>
<view class='iconWrapper'>
<image src='{{x.record.goodsInfo.Icon}}' />
<image src='{{x.record.goodsInfo.play}}' />
</view>
</view>
</view>
</table-column>
</table>