javascript - 小程序样式问题
伊谢尔伦
伊谢尔伦 2017-05-19 10:47:24
0
1
517

如果数据循环出来的话样式就会出现问题 如下图:

代码

<view class="item" wx:for="{{moreTake}}" style="background:url({{item.bgImg}}) no-repeat; background-size:100% 100%;">
      <view class="label">
        <text class="zh">{{item.zhName}}</text>
        <text class="en">{{item.enName}}</text>
      </view>
      <scroll-view class="scroll-view"  scroll-x="true" >
        <view class="type" style="width:360rpx;background:none;"></view>
        <view class="type" wx:for="{{item.content}}">
          <text>{{item.name}}</text>
          <image src="{{item.img}}" style="width:90%;height:130rpx;"></image>
          <text class="btn">+订阅</text>
        </view>
      </scroll-view>
  </view>

如果数据写死的样式正常 如下图

代码

<view class="item" style="background:url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1491565891140&di=483e2b7a953fa5312f8e77148b5c3890&imgtype=0&src=http%3A%2F%2Fimg.article.pchome.net%2F00%2F22%2F80%2F24%2Fpic_lib%2Fwm%2F2366sun008.jpg) no-repeat; background-size:100% 100%;">
      <view class="label">
        <text class="zh">中文</text>
        <text class="en">English</text>
      </view>
      <scroll-view class="scroll-view"  scroll-x="true" >
        <view class="type" style="width:360rpx;background:none;"></view>
        <view class="type">
          <text>精选</text>
          <image src="../../img/i1.png" style="width:90%;height:130rpx;"></image>
          <text class="btn">+订阅</text>
        </view>
        <view class="type">
          <text>精选</text>
          <image src="../../img/i1.png" style="width:90%;height:130rpx;"></image>
          <text class="btn">+订阅</text>
        </view>
        <view class="type">
          <text>精选</text>
          <image src="../../img/i1.png" style="width:90%;height:130rpx;"></image>
          <text class="btn">+订阅</text>
        </view>
      </scroll-view>
  </view>

请问这是什么原因? 谢谢各位

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(1)
習慣沉默

scroll-view需要设置高度 不然数据加载后不会撑开

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!