您好,登錄后才能下訂單哦!
小編給大家分享一下微信小程序如何制作首頁,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
微信小程序 首頁制作簡單實例
實現(xiàn)效果圖:
首先從大的方面來講,就是設置了window的屬性
"navigationBarBackgroundColor": "#AFE2E6",//bar背景顏色 "navigationBarTextStyle": "white",//bar字體顏色 "backgroundColor": "white",//背景顏色 "enablePullDownRefresh": "true"//下拉是否刷新
tabBar屬性
完整代碼如下(wxml)
<view> <navigator url='/pages/14/1'> <view class="waylist"> <view class="im im1">1</view> <view class="way">廣從1號線</view> <view class="ste">市汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> <navigator url='/pages/14/2'> <view class="waylist"> <view class="im im2">2</view> <view class="way">廣從2號線</view> <view class="ste">芳村汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> <navigator url='/pages/14/3'> <view class="waylist"> <view class="im im3">3</view> <view class="way">廣從3號線</view> <view class="ste">羅沖圍汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/4'> <view class="waylist"> <view class="im im4">4</view> <view class="way">廣從4快號線</view> <view class="ste">天河客運站 -從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> <navigator url='/pages/14/5'> <view class="waylist"> <view class="im im4">4</view> <view class="way">廣從4線</view> <view class="ste">天河客運站 -從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> <navigator url='/pages/14/6'> <view class="waylist"> <view class="im im5">5</view> <view class="way">廣從5號線</view> <view class="ste">東站汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> <navigator url='/pages/14/7'> <view class="waylist"> <view class="im im6">6</view> <view class="way">廣從6號線</view> <view class="ste">東圃客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/8'> <view class="waylist"> <view class="im im7">7</view> <view class="way">廣從7號線</view> <view class="ste">黃埔客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/9'> <view class="waylist"> <view class="im im8">8</view> <view class="way">廣從8號線</view> <view class="ste">廣園汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/10'> <view class="waylist"> <view class="im im8">8</view> <view class="way">廣從8快線</view> <view class="ste">廣園汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/11'> <view class="waylist"> <view class="im im9">9</view> <view class="way">廣從9號線</view> <view class="ste">滘口汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/12'> <view class="waylist"> <view class="im im10">10</view> <view class="way">廣從10號線</view> <view class="ste">越秀南客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/13'> <view class="waylist"> <view class="im im10">10</view> <view class="way">廣從10快線</view> <view class="ste">越秀南客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" class="hidden" /> <view class="jian">></view> </view> </navigator> <navigator url='/pages/14/14'> <view class="waylist"> <view class="im im11">11</view> <view class="way">廣從11號線</view> <view class="ste">海珠汽車客運站-從化汽車站</view> <image src="/assets/images/subway.jpg" style="width:30px; height:30px;" /> </view> </navigator> </view>
wxss
.waylist{ display: flex; border-bottom: 1px solid gray; font-size: 13px; } .waylist view{ height:40px; line-height: 40px; } .waylist .im{ width: 25px; height: 25px; line-height: 25px; text-align: center; color:white; margin-top: 7.5px; margin-right: 5px; border-radius: 50px; margin-left: 5px; } .ste{ color:gray; text-align: left; font-size: 12px; width: 60%; } .way{ width: 30%; } .jian{ text-align: right; font-size: 20px; color:gray; } .hidden{ visibility: hidden; } image{ margin-top:5px; } .im1{ } .im2{ } .im3{ } .im4{ } .im5{ } .im6{ } .im7{ } .im8{ } .im9{ } .im10{ } .im11{ }
json文件
{ "navigationBarTitleText": "所有廣從線"//bar內容 }
js文件
Page({ data:{}, onLoad:function(options){ // 頁面初始化 options為頁面跳轉所帶來的參數(shù) }, onReady:function(){ // 頁面渲染完成 }, onShow:function(){ // 頁面顯示 }, onHide:function(){ // 頁面隱藏 }, onUnload:function(){ // 頁面關閉 }, })
看完了這篇文章,相信你對“微信小程序如何制作首頁”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。