<view class="content">
<view class="content-left">
<block wx:for="{{list}}" wx:key="list">
<template is='item-data' data='{{...item}}' wx:if="{{inde % 2==0}}"></template>
</block>
</view>
<view class="content-right">
<block wx:for="{{list}}" wx:key="list">
<template is='item-data' data='{{...item}}' wx:if="{{inde % 2==1}}"></template>
</block>
</view>
</view>
<template name="item-data">
<view class="content-item">
<image src="{{url}}" class="content-item-img" mode="widthFix" />
<view class="content-item-box">
<view class="content-item-title">{{title}}</view>
<view class="content-item-name">
<view class="flex">
<image src="{{avatar}}" class="content-item-avatar" mode="aspectFill" />
<view>{{name}}</view>
</view>
<view class="content-item-num">{{num}}</view>
</view>
</view>
</view>
</template>
data: {
list:[
{
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
},
{
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}, {
name:'song',
num:'10',
title:'他真的很帅',
url:'https://img01.yzcdn.cn/vant/cat.jpeg',
avatar:'https://img01.yzcdn.cn/vant/cat.jpeg'
}
]
}
是 index 不是 inde 你的 wx:if 目前永远是false 肯定不显示了,你可以先把 判断条件删掉调试