h5頁面中有定時器的時候划滋,輪播圖不滾動

(1)輪播圖 react-slick 的使用,但是頁面中有其他定時器的時候,輪播圖不滾動
npm install react-slick

import Carousel from "react-slick";

const settings = { 
speed: 200, 
autoplay: true,
 dots: false, 
infinite: true, 
slidesToShow: 1,   //一頁展示幾條數據
 slidesToScroll: 1,
 vertical: true, 
verticalSwiping: true,
 arrows: false }

 <div style={{backgroundColor:'white',width:275,borderBottomLeftRadius:5,borderBottomRightRadius:5, height: 105, paddingTop: 2,overflow: 'hidden'}}>
          {this.state.users &&<Carousel {...settings}>
             {this.state.users.map((item,index) => {
               return(
                   <div style={{width:275}} key={index}>
                         <div style={{display: 'flex',flexDirection:'row',width:275,paddingLeft:10,paddingRight:10,paddingTop:5,paddingBottom:5,alignItems:'center'}}>
                     <img style={{width:24,height:24}} src={item.headImg} />
                          <span style={{color:'#333333',fontSize:12,marginLeft:8}}>{item.phone}</span>
                           <span style={{color:'#333333',fontSize:12,marginLeft:8}}>{item.content}</span>
                           <span style={{color:'#EE4634',fontSize:12,marginLeft:8}}>{item.amountYuan}</span>
                  </div>
{index < this.state.users.length -1 && <div style={{width:275,height:1,backgroundColor:'#FFF9E7'}}/> }
                                    </div>
                                )
                            })}
                        </Carousel>}
                    </div>

(2)想要輪播滾動雷恃,要用 antd-mobile

npm install antd-mobile

import { Carousel } from 'antd-mobile';
import 'antd-mobile/dist/antd-mobile.css';
const settings = {
         speed: 100,
         autoplay: true,
         dots: false,
         infinite: true,
         slidesToShow: 3,
         slidesToScroll: 1,
         vertical: true,
         verticalSwiping: true,
         arrows:false,
     }

<div style={{ marginLeft: '5%', height: 160, overflow: "hidden"}}>
   {firstBannerList&&firstBannerList.length>0?
       <Carousel {...settings}>
          {firstBannerList.map((item,index) => {
             return(
                   <div style={styles.scrollTextdiv} key={index}>
                         <img style={{ width: 26, height: 26, borderRadius: 13 }} src={item.thumb} />
                          <div style={{display:'flex', flexDirection: 'row', width: '99%', marginLeft: 5, alignItems: 'center', flex: 1 }}>
                                 <p style={{ color: '#333333', fontSize: 11, lineHeight: 13 }}>{item.itemName}</p>
                                 <p style={{ color: '#333333', fontSize: 11, marginLeft: 5, lineHeight: 13 }}>{item.targetPageUrl} </p>
                                  <p style={{ color: '#FF0000', fontSize: 12, lineHeight: 13 }}>{item.targetPageTitle}</p>
                                </div>
                             </div>
                                     )
                                 })}
                        </Carousel>
                         :null
                         }
                     </div>

const styles = {
scrollTextdiv: {
     display: 'flex',
     height: 34,
     flexDirection: 'row',
     alignItems: 'center',
     justifyContent: 'space-between',
     width: '100%',
     paddingTop:10
     // overflow: 'hidden'
 },
}
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末疆股,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子褂萧,更是在濱河造成了極大的恐慌,老刑警劉巖葵萎,帶你破解...
    沈念sama閱讀 222,627評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件导犹,死亡現場離奇詭異,居然都是意外死亡羡忘,警方通過查閱死者的電腦和手機谎痢,發(fā)現死者居然都...
    沈念sama閱讀 95,180評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來卷雕,“玉大人节猿,你說我怎么就攤上這事÷瘢” “怎么了滨嘱?”我有些...
    開封第一講書人閱讀 169,346評論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長浸间。 經常有香客問我太雨,道長,這世上最難降的妖魔是什么魁蒜? 我笑而不...
    開封第一講書人閱讀 60,097評論 1 300
  • 正文 為了忘掉前任囊扳,我火速辦了婚禮,結果婚禮上兜看,老公的妹妹穿的比我還像新娘锥咸。我一直安慰自己,他們只是感情好细移,可當我...
    茶點故事閱讀 69,100評論 6 398
  • 文/花漫 我一把揭開白布搏予。 她就那樣靜靜地躺著,像睡著了一般弧轧。 火紅的嫁衣襯著肌膚如雪缔刹。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,696評論 1 312
  • 那天劣针,我揣著相機與錄音校镐,去河邊找鬼。 笑死捺典,一個胖子當著我的面吹牛鸟廓,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 41,165評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼引谜,長吁一口氣:“原來是場噩夢啊……” “哼牍陌!你這毒婦竟也來了?” 一聲冷哼從身側響起员咽,我...
    開封第一講書人閱讀 40,108評論 0 277
  • 序言:老撾萬榮一對情侶失蹤毒涧,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后贝室,有當地人在樹林里發(fā)現了一具尸體契讲,經...
    沈念sama閱讀 46,646評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,709評論 3 342
  • 正文 我和宋清朗相戀三年滑频,在試婚紗的時候發(fā)現自己被綠了捡偏。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,861評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡峡迷,死狀恐怖银伟,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情绘搞,我是刑警寧澤彤避,帶...
    沈念sama閱讀 36,527評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站夯辖,受9級特大地震影響忠藤,放射性物質發(fā)生泄漏。R本人自食惡果不足惜楼雹,卻給世界環(huán)境...
    茶點故事閱讀 42,196評論 3 336
  • 文/蒙蒙 一模孩、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧贮缅,春花似錦榨咐、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,698評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至桂肌,卻和暖如春数焊,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背崎场。 一陣腳步聲響...
    開封第一講書人閱讀 33,804評論 1 274
  • 我被黑心中介騙來泰國打工佩耳, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人谭跨。 一個月前我還...
    沈念sama閱讀 49,287評論 3 379
  • 正文 我出身青樓干厚,卻偏偏與公主長得像李滴,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子蛮瞄,可洞房花燭夜當晚...
    茶點故事閱讀 45,860評論 2 361

推薦閱讀更多精彩內容