最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue.js輪播圖走馬燈代碼實(shí)例(全)

 更新時間:2019年05月08日 09:10:58   作者:小蘑菇_涼涼  
這篇文章主要介紹了Vue.js輪播圖走馬燈,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

話不多說先上效果圖,本文引薦鏈接http://m.fzitv.net/article/129112.htm

這個是html,

<template>
 <div>
  <div class="back_add">
   <div class="threeImg">
    <div class="Containt">
     <div class="iconleft" @click="zuohua">
      <i class="el-icon-arrow-left"></i>
     </div>
     <ul :style="{'left':calleft + 'px'}" v-on:mouseover="stopmove()" v-on:mouseout="move()">
      <li v-for="(item,index) in superurl" :key="index">
       <img :src="item.img"/>
      </li>
     </ul>
     <div class="iconright" @click="youhua">
      <i class="el-icon-arrow-right" ></i>
     </div>
     
    </div>
   </div>
   
  </div>
 </div>
</template>

數(shù)據(jù)中我用了一個數(shù)組來放圖片的目錄,

data() {
  return {
   superurl: [
    {
     url: '',
     img: '../../../../static/image/home/pictureA.png',
    },
    {
     url: '',
     img: '../../../../static/image/home/pictureB.png',
    },
    {
     url: '',
     img: '../../../../static/image/home/pictureC.png',
    },
    {
     url: '',
     img: '../../../../static/image/home/pictureD.png',
    },
    {
     url: '',
     img: '../../../../static/image/home/showImg1.png',
    },
    {
     url: '',
     img: '../../../../static/image/home/showImg2.png',
    },
   ],
   calleft:0
 
  }

 方法是這樣的

created() {
  this.move()
 },
 methods: {
  //移動
  move() {
   this.timer = setInterval(this.starmove, 2500)
  },
  //開始移動
  starmove() {
   this.calleft -= 340;
   if (this.calleft < -1200) {
    this.calleft = 0
   }
  },
  //鼠標(biāo)懸停時停止移動
  stopmove() {
   clearInterval(this.timer)
  },
  //點(diǎn)擊按鈕左移
  zuohua() {
   this.calleft -= 340;
   if (this.calleft < -1200) {
    this.calleft = 0
   }
  },
  //點(diǎn)擊按鈕右移
  youhua() {
   this.calleft += 340;
   if (this.calleft > 0) {
    this.calleft = -1020
   }
  },
 },

因?yàn)槲覀冎挥徐o態(tài)的圖片所以這么可以,但是如果是取數(shù)據(jù)庫中不定數(shù)量的圖片就不能這么使用了

最后我加上了css樣式就可以了

<style scoped>
/*超鏈接圖片*/
 
#divAdd {
 background-color: #ededed;
 /*width: 100%;*/
 /*min-width: 1200px;*/
 width: 1000px;
 margin: 0px auto;
}
 
.divAdd-con {
 margin: 0px auto;
 width: 1000px;
 overflow: auto;
 padding: 30px 0px;
}
 
.divAdd-con img {
 float: left;
}
 
.indexrt {
 margin: 0px 40px;
}
 
.divAddleft img {
 float: left;
 margin-bottom: 7px;
}
 
.divAddleft {
 float: left;
 display: inline;
 width: 370px;
}
 
.divAddrt {
 float: right;
 display: inline;
 margin-top: 7px;
}
 
.back_add {
 background-color: #ededed;
}
 
.divAdd-con img {
 border: none;
}
 
 
a:focus,
a:hover {
 color: #23527c;
}
 
 
.threeImg {
 height: 158px;
 background: #ededed;
 border-bottom: 3px solid #4679B2;
 min-width: 1000px;
}
 
.threeImg .Containt ul {
 margin: 0 auto;
 width: 2400px;
 position: absolute;
 left: 0px;
 cursor: pointer;
 height: 100%
}
 
.threeImg .Containt ul li {
 width: 300px;
 margin-right: 40px;
 margin-top: 10px;
 float: left;
}
 
.threeImg .Containt ul li img {
 height: 128px;
 width: 100%;
}
 
.Containt {
 position: relative;
 width: 1000px;
 height: 130px;
 overflow: hidden;
 margin: 0 auto;
}
 
.iconleft {
 position: absolute;
 width: 20px;
 height: 80px;
 top: 10px;
 z-index: 99999;
 padding-top: 48px;
 background-color: #ddd;
 vertical-align: middle;
}
 
.iconright {
 position: relative;
 left: 978px;
 top: 70px;
 background-color: #ddd;
 /*position: absolute;*/
 width: 20px;
 height: 80px;
 top: 10px;
 z-index: 99999;
 padding-top: 48px;
 background-color: #ddd;
 vertical-align: middle;
}
</style>

 走馬燈效果引用的是elementUI中的樣式

<template>
 <el-carousel :interval="4000" type="card" height="200px">
 <el-carousel-item v-for="item in 6" :key="item">
  <h3>{{ item }}</h3>
 </el-carousel-item>
 </el-carousel>
</template>
 
<style>
 .el-carousel__item h3 {
 color: #475669;
 font-size: 14px;
 opacity: 0.75;
 line-height: 200px;
 margin: 0;
 }
 
 .el-carousel__item:nth-child(2n) {
 background-color: #99a9bf;
 }
 
 .el-carousel__item:nth-child(2n+1) {
 background-color: #d3dce6;
 }
</style>

輪播效果圖

<template>
 <el-carousel :interval="5000" arrow="always">
 <el-carousel-item v-for="item in 4" :key="item">
  <h3>{{ item }}</h3>
 </el-carousel-item>
 </el-carousel>
</template>
 
<style>
 .el-carousel__item h3 {
 color: #475669;
 font-size: 18px;
 opacity: 0.75;
 line-height: 300px;
 margin: 0;
 }
 
 .el-carousel__item:nth-child(2n) {
 background-color: #99a9bf;
 }
 
 .el-carousel__item:nth-child(2n+1) {
 background-color: #d3dce6;
 }
</style>

以上所述是小編給大家介紹的Vue.js輪播圖走馬燈詳解整合,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • Vue項(xiàng)目中引入外部文件的方法(css、js、less)

    Vue項(xiàng)目中引入外部文件的方法(css、js、less)

    本篇文章主要介紹了Vue項(xiàng)目中引入外部文件的方法(css、js、less),非常具有實(shí)用價值,需要的朋友可以參考下
    2017-07-07
  • Vue 3.0雙向綁定原理的實(shí)現(xiàn)方法

    Vue 3.0雙向綁定原理的實(shí)現(xiàn)方法

    這篇文章主要為大家詳細(xì)介紹了Vue 3.0雙向綁定原理的實(shí)現(xiàn)方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-10-10
  • vue?按需引入vant跟全局引入方式

    vue?按需引入vant跟全局引入方式

    這篇文章主要介紹了vue?按需引入vant跟全局引入方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • vue?+elementui?項(xiàng)目登錄通過不同賬號切換側(cè)邊欄菜單的顏色

    vue?+elementui?項(xiàng)目登錄通過不同賬號切換側(cè)邊欄菜單的顏色

    這篇文章主要介紹了vue?+elementui?項(xiàng)目登錄通過不同賬號切換側(cè)邊欄菜單的顏色,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧
    2024-01-01
  • vue實(shí)現(xiàn)表格增刪改查效果的實(shí)例代碼

    vue實(shí)現(xiàn)表格增刪改查效果的實(shí)例代碼

    本篇文章主要介紹了vue實(shí)現(xiàn)增刪改查效果的實(shí)例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-07-07
  • Vue中TypeScript和Pinia使用方法

    Vue中TypeScript和Pinia使用方法

    這篇文章主要介紹了Vue中TypeScript和Pinia使用方法,讓我們來看一個簡單的示例來演示TypeScript 和 Pinia的強(qiáng)大之處,需要的朋友可以參考下
    2023-07-07
  • vue3.0如何使用computed來獲取vuex里數(shù)據(jù)

    vue3.0如何使用computed來獲取vuex里數(shù)據(jù)

    這篇文章主要介紹了vue3.0如何使用computed來獲取vuex里數(shù)據(jù)問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-04-04
  • vue操作dom元素的3種方法示例

    vue操作dom元素的3種方法示例

    這篇文章主要給大家介紹了關(guān)于vue操作dom元素的3種方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-09-09
  • vue中@keyup.enter失效問題及解決

    vue中@keyup.enter失效問題及解決

    這篇文章主要介紹了vue中@keyup.enter失效問題及解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • Vue實(shí)現(xiàn)路由嵌套的方法實(shí)例

    Vue實(shí)現(xiàn)路由嵌套的方法實(shí)例

    嵌套路由顧名思義就是路由的多層嵌套,這篇文章主要給大家介紹了關(guān)于Vue實(shí)現(xiàn)路由嵌套的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2021-11-11

最新評論

荣成市| 杭锦旗| 绥江县| 丰台区| 龙江县| 陵川县| 达孜县| 会同县| 阿尔山市| 柞水县| 贵定县| 上饶市| 运城市| 临潭县| 南陵县| 巴塘县| 白山市| 大理市| 松原市| 竹山县| 印江| 宝清县| 樟树市| 牟定县| 讷河市| 玛纳斯县| 清远市| 扶绥县| 聂荣县| 思南县| 楚雄市| 昌江| 安新县| 沁水县| 塘沽区| 鸡东县| 金华市| 太谷县| 香港 | 临海市| 宝应县|