欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Element Carousel 走馬燈的具體實現(xiàn)

 更新時間:2020年07月26日 11:15:17   作者:究極死胖獸  
這篇文章主要介紹了Element Carousel 走馬燈的具體實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧

本文來源于Element官方文檔:

http://element-cn.eleme.io/#/zh-CN/component/carousel

基礎用法

普通走馬燈

<div class="block">
<span class="demonstration">默認 Hover 指示器觸發(fā)</span>
<el-carousel height="150px">
<el-carousel-item v-for="item in 4" :key="item">
<h3>{{ item }}</h3>
</el-carousel-item>
</el-carousel>
</div>
<div class="block">
<span class="demonstration">Click 指示器觸發(fā)</span>
<el-carousel trigger="click" height="150px">
<el-carousel-item v-for="item in 4" :key="item">
<h3>{{ item }}</h3>
</el-carousel-item>
</el-carousel>
</div>

組件— 走馬燈

基礎用法

<template>
 <div class="block">
  <span class="demonstration">默認 Hover 指示器觸發(fā)</span>
  <el-carousel height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
 <div class="block">
  <span class="demonstration">Click 指示器觸發(fā)</span>
  <el-carousel trigger="click" height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
</template>

<style>
 .el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
 }

 .el-carousel__item:nth-child(2n) {
   background-color: #99a9bf;
 }
 
 .el-carousel__item:nth-child(2n+1) {
   background-color: #d3dce6;
 }
</style>

指示器

<template>
 <div class="block">
  <span class="demonstration">默認 Hover 指示器觸發(fā)</span>
  <el-carousel height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
 <div class="block">
  <span class="demonstration">Click 指示器觸發(fā)</span>
  <el-carousel trigger="click" height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
</template>

<style>
 .el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
 }

 .el-carousel__item:nth-child(2n) {
   background-color: #99a9bf;
 }
 
 .el-carousel__item:nth-child(2n+1) {
   background-color: #d3dce6;
 }
</style>

切換箭頭

<template>
 <div class="block">
  <span class="demonstration">默認 Hover 指示器觸發(fā)</span>
  <el-carousel height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
 <div class="block">
  <span class="demonstration">Click 指示器觸發(fā)</span>
  <el-carousel trigger="click" height="150px">
   <el-carousel-item v-for="item in 4" :key="item">
    <h3 class="small">{{ item }}</h3>
   </el-carousel-item>
  </el-carousel>
 </div>
</template>

<style>
 .el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  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="4000" type="card" height="200px">
  <el-carousel-item v-for="item in 6" :key="item">
   <h3 class="medium">{{ 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 height="200px" direction="vertical" :autoplay="false">
  <el-carousel-item v-for="item in 3" :key="item">
   <h3 class="medium">{{ 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>

Carousel Attributes

參數(shù) 說明 類型 可選值 默認值
height 走馬燈的高度 string
initial-index 初始狀態(tài)激活的幻燈片的索引,從 0 開始 number 0
trigger 指示器的觸發(fā)方式 string click
autoplay 是否自動切換 boolean true
interval 自動切換的時間間隔,單位為毫秒 number 3000
indicator-position 指示器的位置 string outside/none
arrow 切換箭頭的顯示時機 string always/hover/never hover
type 走馬燈的類型 string card

Carousel Events

事件名稱 說明 回調(diào)參數(shù)
change 幻燈片切換時觸發(fā) 目前激活的幻燈片的索引,原幻燈片的索引

Carousel Methods

方法名 說明 參數(shù)
setActiveItem 手動切換幻燈片 需要切換的幻燈片的索引,從 0 開始;或相應 el-carousel-item 的 name 屬性值
prev 切換至上一張幻燈片
next 切換至下一張幻燈片

Carousel-Item Attributes

參數(shù) 說明 類型 可選值 默認值
name 幻燈片的名字,可用作 setActiveItem 的參數(shù) string
label 該幻燈片所對應指示器的文本 string

到此這篇關(guān)于Element Carousel 走馬燈的具體實現(xiàn)的文章就介紹到這了,更多相關(guān)Element Carousel 走馬燈內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 如何使用yarn創(chuàng)建vite項目+vue3

    如何使用yarn創(chuàng)建vite項目+vue3

    這篇文章主要介紹了如何使用yarn創(chuàng)建vite項目+vue3,詳細介紹了使用vite創(chuàng)建vue3過程,本文給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
    2024-03-03
  • 如何利用 vue實現(xiàn)鼠標懸停時顯示元素或文本

    如何利用 vue實現(xiàn)鼠標懸停時顯示元素或文本

    Vue.js 是一種流行的 JavaScript 框架,可以使 Web 應用程序的開發(fā)變得更加輕松和高效,這篇文章主要介紹了在 vue 中鼠標懸停時顯示元素或文本,需要的朋友可以參考下
    2023-05-05
  • vue3中使用router路由實現(xiàn)跳轉(zhuǎn)傳參的方法

    vue3中使用router路由實現(xiàn)跳轉(zhuǎn)傳參的方法

    這篇文章主要介紹了vue3中使用router路由實現(xiàn)跳轉(zhuǎn)傳參的方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-03-03
  • 解決router.beforeEach()動態(tài)加載路由出現(xiàn)死循環(huán)問題

    解決router.beforeEach()動態(tài)加載路由出現(xiàn)死循環(huán)問題

    這篇文章主要介紹了解決router.beforeEach()動態(tài)加載路由出現(xiàn)死循環(huán)問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • Vue.js動態(tài)添加、刪除選題的實例代碼

    Vue.js動態(tài)添加、刪除選題的實例代碼

    這篇文章主要介紹了Vue.js動態(tài)添加、刪除選題的實例代碼,非常不錯具有參考借鑒價值,需要的朋友可以參考下
    2016-09-09
  • VSCode前端Vue項目引入Element-ui組件三步簡單操作方法

    VSCode前端Vue項目引入Element-ui組件三步簡單操作方法

    elementui相當于一個庫,封裝好的內(nèi)容,我們引入到vue項目中,就可用庫中的內(nèi)容,這篇文章主要給大家介紹了關(guān)于VSCode前端Vue項目引入Element-ui組件的三步簡單操作方法,需要的朋友可以參考下
    2024-07-07
  • Vuex中Store的簡單實現(xiàn)

    Vuex中Store的簡單實現(xiàn)

    這篇文章主要介紹了Vuex中Store的簡單實現(xiàn),為了在 Vue 組件中訪問 this.$store property,你需要為 Vue 實例提供創(chuàng)建好的 store,Vuex 提供了一個從根組件向所有子組件,以 store 選項的方式 注入 該 store 的機制,需要的朋友可以參考下
    2023-11-11
  • Vue3 之 Vue 事件處理指南

    Vue3 之 Vue 事件處理指南

    Vue事件處理是每個Vue項目的必要方面。 它用于捕獲用戶輸入,共享數(shù)據(jù)以及許多其他創(chuàng)造性方式。在本文中,會介紹基礎知識,并提供一些用于處理事件的代碼示例。需要的小伙伴可以參考下面文章的具體內(nèi)容
    2021-09-09
  • 基于Element封裝一個表格組件tableList的使用方法

    基于Element封裝一個表格組件tableList的使用方法

    這篇文章主要介紹了基于Element封裝一個表格組件tableList的使用方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-06-06
  • vue-cli設置publicPath小記

    vue-cli設置publicPath小記

    這篇文章主要介紹了vue-cli設置publicPath小記,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-04-04

最新評論