使用官方demo稍微改了下,就复现了。
启动页面设置成grid-demo-1/index。
代码片段:https://developers.weixin.qq.com/s/NcOg4lmh7CQG
<scroll-view scroll-y style="width: 100%; height: 100%;" type="custom">
<grid-view type="masonry" cross-axis-count="{{crossAxisCount}}" cross-axis-gap="{{crossAxisGap}}" main-axis-gap="{{mainAxisGap}}">
<grid-tile wx:for="{{gridList}}" wx:key="id" index="{{item.id}}" height="{{100 * item.sub}}"></grid-tile>
</grid-view>
<grid-view wx:if="{{aaaa}}" type="masonry" cross-axis-count="{{crossAxisCount}}" cross-axis-gap="{{crossAxisGap}}" main-axis-gap="{{mainAxisGap}}">
<grid-tile wx:for="{{gridList}}" wx:key="id" index="{{item.id}}" height="{{100 * item.sub}}"></grid-tile>
</grid-view>
</scroll-view>
使用官方demo稍微改了下,就复现了。
// grid-demo-1/index.js
import { generateGridList } from '../utils'
Page({
/**
* 页面的初始数据
*/
data: {
aaaa: false,
crossAxisCount: 2,
crossAxisGap: 8,
mainAxisGap: 10,
gridList: generateGridList(10, 4),
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
setTimeout(() => {
const gridList = this.data.gridList;
this.setData({
gridList: [...gridList,...generateGridList(10, 4)],
aaaa: true,
})
}, 2000);
},
})
能了解下这里是什么应用场景吗? 目前 grid-view 是只支持单个,多个需要额外支持一下