如图,这个是在调试工具里的代码,迷一样的前后多出一行,导致这一行被挤下去,样式难搞。
代码真的简单到裂开
wxml:
<scroll-view class="scroll" scroll-y>
<view wx:for="{{list1}}" wx:key="k">
<text class="a">{{item.k}}</text>
<text class="b">
<text wx:for="{{item.l2}}" wx:for-item="list2">
{{list2.a}}
</text>
</text>
</view>
</scroll-view>
js:
/**
* 页面的初始数据
*/
data: {
list1: [
{l2: [{a:'asdf', b:'asdfasdf'},{a:'asdf', b:'asdfasdf'},{a:'asdf', b:'asdfasdf'}], k: 1},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 2},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 3},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 4},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 5},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 7},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 8},
{l2: [{a:'asdf', b:'asdfasdf'}], k: 9}
]
},
css:
.scroll{
height: 300px;
}
.b{
display: block;
width: 300px;
height: 50px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
运行结果截图:
就迷一样的内部循环前面多了一行空行,真的绝了,求助!怎么去掉这个前后的空行?感激不尽!版本库是2.18.0
把红框地方的空格和换行符删了
然后告诉你的格式化插件不要管text标签