weex横向列表

 

实现左右滑动的列表,我这边使用 weex的 Scorller组件:

从weex文档上找到依据:http://dotwe.org/vue/c626a5fb4981e8e8bce92d7b012c26b4

vue文件中使用:

重点:

<scroller scroll-direction="horizontal" style="flex-direction: row">
<div style="background-color: white;height: 80px;padding-left: 24px">
    <scroller scroll-direction="horizontal" style="flex-direction: row">
        <div v-for="(item,index) in orgTagList">
            <div style="height: 88px;align-items: center;flex-direction: row">
                <text v-if="orgTagList.length-1 === index " style="line-height:88px; font-size: 30px;color: #999;">{{item.name}}</text>
                <text v-else style="font-size: 30px;color: #0a3470;line-height:88px; " @click="tagClick(item)">{{item.name}}</text>
                <text v-if="orgTagList.length-1 !== index " style="font-weight:bold; line-height:88px;width: 37px; font-size: 30px;color: #999;margin-left: 5px;margin-right: 5px">→</text>
            </div>
        </div>
    </scroller>
</div>

测试数据:

let iii = { name:'小明' };
let ddd = { name:'王丽' };
let fff = { name:'婷婷' };
let ggg = { name:'风儿' };
let hhh = { name:'弈可' };

this.orgTagList.push(iii);
this.orgTagList.push(ddd);
this.orgTagList.push(fff);
this.orgTagList.push(ggg);
this.orgTagList.push(hhh);
this.orgTagList.push(ddd);
this.orgTagList.push(fff);
this.orgTagList.push(ggg);
this.orgTagList.push(hhh);

 补充使用bug:(android weex-sdk 20.0以上,如上面这样写会出现,弹出去的数据,view依然站位的情况):

         scroller 标签里边,就只能有一个div标签,然后设置div  style="flex-direction: row"

这样写即可:

<scroller scroll-direction="horizontal" style="flex-direction: row">
    <div style="flex-direction: row">
        <div v-for="(item,index) in options">
        </div>
    </div>
</scroller>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

漠天515

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值