最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)簡易table表格

 更新時間:2020年06月19日 16:27:16   作者:oys1341  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)簡易table表格,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了微信小程序?qū)崿F(xiàn)簡易表格的具體代碼,供大家參考,具體內(nèi)容如下

由于需要開發(fā)小程序,前端又是自己弄,類似table的標(biāo)簽也沒有,后來看到小程序文檔中推薦使用flex布局,就把css中的flex布局學(xué)了一遍,效果還行,大家將就看一下

table.wxml

<view class="table">
 <view class="tr bg-w">
 <view class="th">head1</view>
 <view class="th">head2</view>
 <view class="th ">head3</view>
 </view>
 <block wx:for="{{listData}}" wx:key="{[code]}">
 <view class="tr bg-g" wx:if="{{index % 2 == 0}}">
 <view class="td">{{item.code}}</view>
 <view class="td">{{item.text}}</view>
 <view class="td">{{item.type}}</view>
 </view>
 <view class="tr" wx:else>
 <view class="td">{{item.code}}</view>
 <view class="td">{{item.text}}</view>
 <view class="td">{{item.type}}</view>
 </view>
 </block>
</view>

table.wxss

.table {
 border: 0px solid darkgray;
}
.tr {
 display: flex;
 width: 100%;
 justify-content: center;
 height: 3rem;
 align-items: center;
}
.td {
 width:40%;
 justify-content: center;
 text-align: center;
}
.bg-w{
 background: snow;
}
.bg-g{
 background: #E6F3F9;
}
.th {
 width: 40%;
 justify-content: center;
 background: #3366FF;
 color: #fff;
 display: flex;
 height: 3rem;
 align-items: center;
}

table.js

Page({
 data: {
 listData:[
 {"code":"01","text":"text1","type":"type1"},
 {"code":"02","text":"text2","type":"type2"},
 {"code":"03","text":"text3","type":"type3"},
 {"code":"04","text":"text4","type":"type4"},
 {"code":"05","text":"text5","type":"type5"},
 {"code":"06","text":"text6","type":"type6"},
 {"code":"07","text":"text7","type":"type7"}
 ]
 },
 onLoad: function () {
 console.log('onLoad') 
 }

})

效果圖如下

其實這也是很簡單flex布局,更復(fù)雜的布局就交給大家了

為大家推薦現(xiàn)在關(guān)注度比較高的微信小程序教程一篇:《微信小程序開發(fā)教程》小編為大家精心整理的,希望喜歡。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

旬阳县| 桐城市| 漳州市| 金秀| 榆树市| 河西区| 京山县| 吴川市| 兰西县| 海口市| 五莲县| 宁海县| 易门县| 山西省| 普宁市| 南城县| 商河县| 襄樊市| 达孜县| 安达市| 文安县| 临洮县| 邻水| 丰城市| 方正县| 塘沽区| 兴文县| 胶南市| 香河县| 宁明县| 莆田市| 泰安市| 五家渠市| 滦平县| 渭南市| 新沂市| 贡觉县| 陵川县| 宁远县| 祁东县| 灌南县|