新建目錄 posts (閱讀頁面)
點擊目錄右鍵新建page
目錄結構如下:

在app.json中,把posts調整為默認顯示的頁面(暫時先這樣,具體的多頁面之后再說)
{ "pages": [ "pages/posts/posts", "pages/welcome/welcome" ], "window": { "navigationBarBackgroundColor": "#405f80" }, "sitemapLocation": "sitemap.json" }
官方檔案里找到swiper組件

posts.wxml
<!--pages/posts/posts.wxml--> <view> <swiper indicator-dots="true" interval="2000" autoplay="true"> <swiper-item><image src="/images/wx.png"></image></swiper-item> <swiper-item><image src="/images/vr.png"></image></swiper-item> <swiper-item><image src="/images/iqiyi.png"></image></swiper-item> </swiper> </view>
posts.wxss
注意輪播圖的尺寸取決于swiper容器的尺寸,而不是swiper-item的尺寸

/* pages/posts/posts.wxss */ swiper{ width:100%; height:500rpx; } swiper image{ width:100%; height:500rpx; }
效果圖:

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/139985.html
標籤:JavaScript
