微信小程序:Flex佈局VS普通佈局

时间:2017-11-13 13:52:39   收藏:0   阅读:220
普通佈局思維:
CSS:
  .cases-left,.cases-right{width:47%;float:left;margin-left:2%;}
Flex思維:
CSS:
  .cases{display:flex;flex-flow:row wrap;justify-content:space-around;}
 
普通動態寬度:
Html:
  <view style="width:{{vW}}" wx:for="{{view}}">{{item}}</view>
Js:
  vW = 1 / (view.length) * 100 + "%";
  this.setData({vW})
Flex動態寬度:
CSS:
  .vW{display:flex;flex-flow:row nowrap;justify-content:space-around;}
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!