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

vue中如何動(dòng)態(tài)設(shè)置css樣式的hover

 更新時(shí)間:2022年10月09日 10:59:11   作者:造糖主義  
這篇文章主要介紹了vue中如何動(dòng)態(tài)設(shè)置css樣式的hover,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vue動(dòng)態(tài)設(shè)置css樣式的hover

1.定義不同的顏色數(shù)組

colorList: ['#4cb352', '#5bc2d3', '#ffc23f', 'pink', '#872822'],//課件標(biāo)題顏色

2.html數(shù)據(jù)遍歷-自定義element-走馬燈高度+定義css變量-yf-border-color

?<div
? ? ? ? ? ? v-for="(item, index) in listData"
? ? ? ? ? ? :key="`${index}`"
? ? ? ? ? ? :class="`partCurriculum`"
? ? ? ? ? ? :style="`color:${colorList[index]};--yf-border-color:${colorList[index]}`"
? ? ? ? ? >
? ? ? ? ? ? <div class="partCurriculumTitle">{{ item.subjectName }}</div>
? ? ? ? ? ? <div class="moreLink" style="cursor: pointer;" @click="toDownload">
? ? ? ? ? ? ? 更多課件
? ? ? ? ? ? ? <img src="../../assets/img/more_class_btn.png" />
? ? ? ? ? ? </div>

? ? ? ? ? ? <el-carousel
? ? ? ? ? ? ? trigger="click"
? ? ? ? ? ? ? :autoplay="false"
? ? ? ? ? ? ? class="partCurriculumVideo"
? ? ? ? ? ? ? :height="
? ? ? ? ? ? ? ? item.courseWaresList[0].length > 6
? ? ? ? ? ? ? ? ? ? '740px'
? ? ? ? ? ? ? ? ? : item.courseWaresList[0].length <= 3
? ? ? ? ? ? ? ? ? ? '250px'
? ? ? ? ? ? ? ? ? : '500px'
? ? ? ? ? ? ? "
? ? ? ? ? ? >
? ? ? ? ? ? ? <el-carousel-item
? ? ? ? ? ? ? ? v-for="(tItem,tIndex) in item.courseWaresList"
? ? ? ? ? ? ? ? :key="`${tItem}${tIndex}`"
? ? ? ? ? ? ? ? class="video_connent"
? ? ? ? ? ? ? >
? ? ? ? ? ? ? ? <div
? ? ? ? ? ? ? ? ? v-for="(LItem,LIndex) in tItem"
? ? ? ? ? ? ? ? ? :class="`videoBlock`"
? ? ? ? ? ? ? ? ? :key="`${LItem}${LIndex}`"
? ? ? ? ? ? ? ? >
? ? ? ? ? ? ? ? ? <img :src="LItem.coursewareImg" alt="正在加載,請耐心等待" />?
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? </el-carousel-item>
? ? ? ? ? ? </el-carousel>

3.css添加hover

? .videoBlock {
? ? position: relative;
? ? width: 29%;
? ? height: 220px;
? ? box-sizing: border-box;
? ? color: #ccc;
? ? &:hover {
? ? ? border: 4px solid var(--yf-border-color, #4cb352);
? ? }
? ? img {
? ? ? width: 100%;
? ? ? height: 100%;
? ? ? display: block;
? ? }
? }

vue使用hover.css動(dòng)畫

介紹:

  • 一組 CSS3 驅(qū)動(dòng)的懸停效果,可應(yīng)用于鏈接、按鈕、徽標(biāo)、SVG、特色圖像等。
  • 輕松應(yīng)用于您自己的元素、修改或僅用于靈感。
  • 在 CSS、Sass 和 LESS 中可用。

1.下載hover.css

npm i hover.css --save

2. 全局映入css

import 'hover.css'

3.使用類,加上類名 button hvr-bounce-to-left

<div class="an ?button hvr-bounce-to-left">
? ? 天天向上,好好學(xué)習(xí)
</div>
.an {
? height: 100px;
? width: 200px;
? background-color: blueviolet;
? border-radius: 10px;
? float: left;
? margin: 10px;
? vertical-align: middle;
}

4.拿到想要的樣式類名 通過f12查看div上面的class類名 點(diǎn)擊下面鏈接地址 

hover.css 鏈接地址

總結(jié):以上四步就可以實(shí)現(xiàn)hover.css動(dòng)畫的基本使用。

頁面所有代碼

<template>
  <!-- http://ianlunn.github.io/Hover/ hover  css動(dòng)畫網(wǎng)址 -->
  //圖層左彈出
  <div class="an  button hvr-bounce-to-left">
    天天向上,好好學(xué)習(xí)
  </div>
   //圖層右彈出
  <div class="an  button hvr-sweep-to-right">
    天天向上,好好學(xué)習(xí)
  </div>
  <div class="an button hvr-grow">天天向上,好好學(xué)習(xí)</div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import "hover.css";
export default defineComponent({
  setup() {},
});
</script>

<style scoped>
.an {
  height: 100px;
  width: 200px;
  background-color: blueviolet;
  border-radius: 10px;
  float: left;
  margin: 10px;
  vertical-align: middle;
}
</style>

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

冀州市| 视频| 内江市| 枝江市| 房产| 贺州市| 康平县| 阜阳市| 安溪县| 顺义区| 东兴市| 安福县| 山东省| 柏乡县| 芜湖县| 和静县| 临西县| 密山市| 洛阳市| 新野县| 石家庄市| 米脂县| 舞钢市| 新津县| 通辽市| 双辽市| 正安县| 五寨县| 廉江市| 黔西| 洛宁县| 章丘市| 什邡市| 朝阳市| 师宗县| 克什克腾旗| 改则县| 清徐县| 皋兰县| 岢岚县| 扎囊县|