网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網(wǎng)

微信小程序全局配置與輪播圖

發(fā)布時間:2018-04-18 09:49 所屬欄目:小程序開發(fā)教程

作者:漢堡請不要欺負面條,來自原文地址

 

一:全局配置

一.app.json 
使用app.json文件來對微信小程序進行全局配置,決定頁面文件的路徑、窗口表現(xiàn)、設(shè)置網(wǎng)絡(luò)超時時間、設(shè)置多 tab 等. 

注意在.json不能注釋,否則會出錯。

二.工具欄tabBar 
如果我們的小程序是一個多 tab 應(yīng)用(客戶端窗口的底部或頂部有 tab 欄可以切換頁面),那么我們可以通過 tabBar 配置項指定 tab 欄的表現(xiàn),以及 tab 切換時顯示的對應(yīng)頁面。 
tabBar 是一個數(shù)組,只能配置最少2個、最多5個 tab,tab 按數(shù)組的順序排序 

app.json中

 

  1. {
  2. "pages": ["pages/index/index",
  3. "pages/coming/coming",
  4. "pages/search/search",
  5. "pages/top/top"
  6. ],
  7. "window": {
  8. "navigationBarBackgroundColor": "#47a86c",
  9. "navigationBarTextStyle": "white",
  10. "navigationBarTitleText": "小程序案例",
  11. "backgroundColor": "#fff",
  12. "backgroundTextStyle": "dark"
  13. },
  14. "tabBar": {
  15. "color": "#686868",
  16. "selectedColor": "#47a86c",
  17. "backgroundColor": "#fff",
  18. "list": [{
  19. "pagePath": "pages/index/index",
  20. "iconPath": "dist/images/popular_icon.png",
  21. "selectedIconPath": "dist/images/popular_active_icon.png",
  22. "text": "熱映"
  23. },
  24. {
  25. "pagePath": "pages/coming/coming",
  26. "iconPath": "dist/images/coming_icon.png",
  27. "selectedIconPath": "dist/images/coming_active_icon.png",
  28. "text": "待映"
  29. },
  30. {
  31. "pagePath": "pages/search/search",
  32. "iconPath": "dist/images/search_icon.png",
  33. "selectedIconPath": "dist/images/search_active_icon.png",
  34. "text": "搜索"
  35. },
  36. {
  37. "pagePath": "pages/top/top",
  38. "iconPath": "dist/images/top_icon.png",
  39. "selectedIconPath": "dist/images/top_active_icon.png",
  40. "text": "口碑"
  41. }]
  42. },
  43. "networkTimeout": {
  44. "request": 10000,
  45. "downloadFile": 10000
  46. },
  47. "debug": true
  48. }

圖標可以放在與pages同級,文件命名可是自定。 

app.json中其他屬性:可以查看手冊,里面有詳解

 

二:輪播圖

1.編寫頁面結(jié)構(gòu)  pages/index/index.wxml

 

  1. <!--index.wxml-->
  2. <view>
  3. <swiper indicator-dots="{{indicatorDots}}"
  4. autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
  5. <block wx:for="{{imgUrls}}">
  6. <swiper-item>
  7. <navigator url="{{item.link}}" hover-class="navigator-hover">
  8. <image src="{{item.url}}" class="slide-image" width="355" height="150"/>
  9. </navigator>
  10. </swiper-item>
  11. </block>
  12. </swiper>
  13. </view>

注意:不要在view中加css設(shè)置:display: flex;否則效果呈現(xiàn)不了  2.設(shè)置數(shù)據(jù)  了解屬性,方可設(shè)置 

  在index.js中設(shè)置數(shù)據(jù)

 

  1. //index.js
  2. //獲取應(yīng)用實例
  3. var app = getApp()
  4. Page({
  5. data: {
  6. imgUrls: [ {
  7. link:'/pages/index/index',
  8. url:'../uploads/a01.jpg'
  9. },{
  10. link:'/pages/logs/logs',
  11. url:'../uploads/a02.jpg'
  12. },{
  13. link:'/pages/user/user',
  14. url:'../uploads/a03.jpg'
  15. }
  16. ],
  17. indicatorDots: true,
  18. autoplay: true,
  19. interval: 5000,
  20. duration: 1000
  21. }
  22. })

3.效果



易優(yōu)小程序(企業(yè)版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/23621.html 復(fù)制鏈接 如需定制請聯(lián)系易優(yōu)客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×