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

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

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

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

由于需要開發(fā)小程序,前端又是自己弄,類似table的標簽也沒有,后來看到小程序文檔中推薦使用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)文章

最新評論

屏南县| 武强县| 聂拉木县| 寿阳县| 镇坪县| 太仓市| 丰宁| 南充市| 成武县| 南昌县| 重庆市| 晴隆县| 阳东县| 平武县| 石阡县| 仙居县| 望江县| 师宗县| 吉木萨尔县| 拜泉县| 勐海县| 呼伦贝尔市| 根河市| 阿克苏市| 宁阳县| 安阳县| 秦皇岛市| 辽源市| 思茅市| 长春市| 百色市| 廊坊市| 瑞昌市| 康定县| 涞源县| 什邡市| 大连市| 沈阳市| 儋州市| 县级市| 深泽县|