横向滚动的控件是否是需要自己做呢?
scroller和list都可以横向滚动的
https://github.com/sunbohong/weex/tree/ios-2016%E5%B9%B406%E6%9C%8827%E6%97%A5
我修改了scroller-demo的子视图布局,但是scroller的范围并没有和预期的一样进行自适应
另外,http://alibaba.github.io/weex/doc/components/scroller.html 这份文档提到A vertical scroller。
这份文档是否需要更新呢?
Summary
A vertical scroller which can have multiple child components arranged in one column. If total height of its child components is higher then the height of itself, the whole child components are scrollable.
Notes: A
can be used as a root element or a embed element. The scoll direction of this component is column, and it can't be changed.
请清楚的说明一下 具体的问题,scroller-demo的代码请直接贴一下
<template>
<scroller class="list">
<div class="section" repeat="{{sections}}" style="flex-direction:row">
<div class="header">
<text class="header-title">{{title}}</text>
</div>
<div class="item" repeat="{{items}}">
<text class="item-title">row {{id}}</text>
</div>
</div>
</scroller>
</template>
上面的代码导致div的宽度大于scroller的宽度,但是,实际执行时,scroller的contensize没有自适应,并且不能横向滚动。

@sunbohong , 可否提供完整的代码示例,我们帮你看下。
<template>
<scroller class="list">
<div class="section" repeat="{{sections}}" style="flex-direction:row">
<div class="header">
<text class="header-title">{{title}}</text>
</div>
<div class="item" repeat="{{items}}">
<text class="item-title">row {{id}}</text>
</div>
</div>
</scroller>
</template>
<script>
require('weex-components');
module.exports = {
data: {
img: '//gw.alicdn.com/tps/i2/TB1DpsmMpXXXXabaXXX20ySQVXX-512-512.png_400x400.jpg'
},
methods: {
toast: function() {
this.$call('modal', 'toast', {'message': 'a toast', 'duration': 2});
}
}
}
</script>
<style>
.header {
background-color: #45b5f0;
padding: 20px;
height: 88px;
justify-content: center;
}
.header-title {
color: white;
font-weight: bold;
}
.item {
justify-content: center;
border-bottom-width: 2px;
border-bottom-color: #c0c0c0;
height: 100px;
padding: 10px;
}
.item-title {
}
</style>
<script>
require('weex-components');
module.exports = {
methods: {
},
data: {
sections: [
{
title: 'Header 1',
items: [
{id: 1},
{id: 2},
{id: 3},
{id: 4},
{id: 5}
]
},
{
title: 'Header 2',
items: [
{id: 6},
{id: 7},
{id: 8},
{id: 9},
{id: 10},
{id: 11}
]
}
],
moreSections: [
{
title: 'Header 3',
items: [
{id: 12},
{id: 13},
{id: 14},
{id: 15},
{id: 16},
{id: 17},
{id: 18}
]
},
{
title: 'Header 4',
items: [
{id: 19},
{id: 20},
{id: 21},
{id: 22}
]
},
{
title: 'Header 5',
items: [
{id: 23},
{id: 24},
{id: 25},
{id: 26},
{id: 27}
]
},
{
title: 'Header 6',
items: [
{id: 28},
{id: 29},
{id: 30},
{id: 31},
{id: 32}
]
},
]
},
}
</script>
@sunbohong 请在scroller标签上加 scroll-direction="horizontal" , 文档可以参考这里