課程
/AI人工智能
/AI語(yǔ)音
/uni-app 快速入門,打造3端在線教育類app
前一張都會(huì)多一部分出去
2023-08-25
源自:uni-app 快速入門,打造3端在線教育類app 3-5
正在回答
swiper組件??next-margin屬性設(shè)置問(wèn)題,還有就是你的素材圖片要一樣大小哦
寬度減去左右內(nèi)邊距就好了
<template> <view?class="banner-box"> <view?class="banner-bg"?:style="{'background-image':?`linear-gradient(${bannerBackground?||?'#345DC2'}?50%,?#FFF)`}"?></view> <swiper? class="banner-swipper" indicator-dots?indicator-color="rgba(255,255,255,0.5)"?indicator-active-color="#FFFFFF" autoplay?:interval="4000"?:current="current"?@change="swiperChange" > <swiper-item?class="swiper-item"?v-for="(item,index)?in?bannerList"?:key="index"> <image?:src="item.imageUrl"></image> <div>{{item.background}}</div> </swiper-item> </swiper> </view> </template> <script> ? ? export?default?{ name:"jingBanner", props:{ bannerList:{ type:?Array, default:()=>[ { id:1, imageUrl:"../../static/images/it01.png", background:'#009B8C', advertUrl:"/pages/course/course-details" }, { id:2, imageUrl:"../../static/images/it02.png", background:'#6E3DE6', advertUrl:"/pages/course/course-details" }, { id:3, imageUrl:"../../static/images/it03.png", background:'#0D81ED', advertUrl:"/pages/course/course-details" }, { id:3, imageUrl:"../../static/images/it04.png", background:'#dda0dd', advertUrl:"/pages/course/course-details" }, ] }, }, ? data()?{ return?{ current:?0,//?當(dāng)前所在滑塊的index bannerBackground:''?//背景色 }; }, methods:{ swiperChange(e){ this.current?=?e.detail.current; this.bannerBackground?=?this.bannerList[this.current].background console.log(e); } } } </script> <style> ? .banner-box{ ?padding:?0?30rpx; ?padding-top:?120rpx; .banner-bg{ position:?absolute; top:?0; left:?-30rpx; width:?130%; height:?470rpx; transform:?.5s; background-image:?linear-gradient(red?50%,?#FFF); } .banner-swipper{ height:?350rpx; .swiper-item{ height:?100%; image{ width:?100%; height:?100%; border-radius:?15rpx; } } } } </style>
舉報(bào)
從基礎(chǔ)到案例,帶你走進(jìn)uniapp的世界。
1 回答老師,這個(gè)教程的源碼鏈接在哪里?我要下載些資源圖片?
1 回答老師請(qǐng)幫忙看看哪錯(cuò)了
1 回答老師 請(qǐng)問(wèn)為什么會(huì)出現(xiàn)這種情況?
1 回答老是請(qǐng)問(wèn)我在swiper-item中設(shè)置了padding 超出了父容器100%的寬度 導(dǎo)致swiper顯示異常,請(qǐng)問(wèn)一下這種情況如何解決呢
1 回答為什么會(huì)出現(xiàn)這個(gè)報(bào)錯(cuò)檢查了很多遍了
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2023-10-12
swiper組件??next-margin屬性設(shè)置問(wèn)題,還有就是你的素材圖片要一樣大小哦
2024-06-20
寬度減去左右內(nèi)邊距就好了
2023-12-04