" />

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

vue使用動(dòng)畫實(shí)現(xiàn)滾動(dòng)表格效果

 更新時(shí)間:2022年04月11日 15:47:00   作者:qq_33203555  
這篇文章主要為大家詳細(xì)介紹了vue使用動(dòng)畫實(shí)現(xiàn)滾動(dòng)表格效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue使用動(dòng)畫實(shí)現(xiàn)滾動(dòng)表格效果的具體代碼,供大家參考,具體內(nèi)容如下

需求

在一些大屏項(xiàng)目中,需要使用到表格行數(shù)據(jù)滾動(dòng)。本文介紹在vue項(xiàng)目中使用動(dòng)畫實(shí)現(xiàn)滾動(dòng)表格。

vue代碼如下

<template>
? <div style="cursor: default;margin:9px 10px 18px">
? ? <div class="table-header table-row">
? ? ? <div class="table-cell" style="width: 25%">計(jì)劃名稱</div>
? ? ? <div class="table-cell" style="width: 40%">核心企業(yè)</div>
? ? ? <div class="table-cell" style="width: 15%">發(fā)行狀態(tài)</div>
? ? ? <div class="table-cell" style="width: 20%;text-align:right">金額(元)</div>
? ? </div>
? ? <div class="table-body">
? ? ? <div :class="{ 'scroll-wrap': getPlayData.length > 0 }">
? ? ? ? <div
? ? ? ? ? class="table-row"
? ? ? ? ? :class="{ hasBgc: index % 2 === 0 }"
? ? ? ? ? v-for="(item, index) in getPlayData"
? ? ? ? ? :key="index"
? ? ? ? ? :ref="'row_' + index"
? ? ? ? >
? ? ? ? ? <div class="table-cell" style="width: 25%" :title="item.productName">
? ? ? ? ? ? {{ item.productName }}
? ? ? ? ? </div>
? ? ? ? ? <div class="table-cell" style="width: 40%" :title="item.coreName">{{ item.coreName }}</div>
? ? ? ? ? <div class="table-cell" style="width: 15%" :title="item.publish">{{ item.publish }}</div>
? ? ? ? ? <div class="table-cell" style="width: 20%;text-align:right" :title="item.publishAmount">
? ? ? ? ? ? {{ item.publishAmount }}
? ? ? ? ? </div>
? ? ? ? </div>
? ? ? </div>
? ? </div>
? </div>
</template>
<script>
export default {
? props: {
? ? data: {
? ? ? type: Array,
? ? ? default: () => {
? ? ? ? return [];
? ? ? },
? ? },
? },
? data() {
? ? return {
? ? ? initMt: 0,
? ? ? // getPlayData:[],
? ? ? visible: true,
? ? ? stop: false,
? ? };
? },
? methods: {
? ? play() {
? ? ? const row = this.$refs["row_0"][0];

? ? ? setTimeout(() => {
? ? ? ? this.visible = false;

? ? ? ? this.$nextTick(() => {
? ? ? ? ? this.initMt++;
? ? ? ? ? if (this.initMt === this.data.length) {
? ? ? ? ? ? this.initMt = 0;
? ? ? ? ? }
? ? ? ? ? this.visible = true;
? ? ? ? });
? ? ? ? this.play();
? ? ? }, 2000);
? ? },
? },
? watch: {

? },
? computed: {
? ? getPlayData() {
? ? ? return this.data.concat(this.data.slice(0, 4));
? ? },
? },
? mounted() {
? ? // this.play();
? },
};
</script>
<style lang="scss" scoped>
$cellHeight: 35px;
.table-row {
? display: flex;
? line-height: 35px;
? height: 35px;
? transition: all 0.3s;
? border-bottom: 1px solid rgba(63, 88, 114, 1);
}
.table-header {
? color: rgba(87, 150, 190, 1);
}
.table-cell {
? text-align: left;
? font-size: 12px;
? text-overflow: ellipsis;
? overflow: hidden;
}
// .hasBgc {
// ? background: rgb(0, 59, 81);
// }
.hidden-row {
? height: 0 !important;
? line-height: 0 !important;
? display: none !important;
}
.table-body {
? height: 142px;
? overflow-y: hidden;
? .table-row {
? ? color: #fff;
? }
}
.scroll-wrap {
? animation: scroll 18s linear infinite;
? position: relative;
}
.scroll-wrap:hover {
? animation-play-state: paused;
}
@keyframes scroll {
? from {
? ? top: 0;
? }
? to {
? ? top: -8 * $cellHeight;
? }
}
</style>

通過(guò)動(dòng)畫動(dòng)態(tài)改變表格的位置來(lái)達(dá)到移動(dòng)的效果。把數(shù)據(jù)的一半拼接在原數(shù)據(jù)上作為滾動(dòng)數(shù)據(jù),達(dá)到銜接的效果。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue中使用TypeScript的方法

    vue中使用TypeScript的方法

    這篇文章主要介紹了vue中使用TypeScript的方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-08-08
  • 一篇文章告訴你Vue3指令是如何實(shí)現(xiàn)的

    一篇文章告訴你Vue3指令是如何實(shí)現(xiàn)的

    在計(jì)算機(jī)技術(shù)中,指令是由指令集架構(gòu)定義的單個(gè)的CPU操作,在更廣泛的意義上,“指令”可以是任何可執(zhí)行程序的元素的表述,例如字節(jié)碼,下面這篇文章主要給大家介紹了關(guān)于Vue3指令是如何實(shí)現(xiàn)的相關(guān)資料,需要的朋友可以參考下
    2022-01-01
  • 使用Vue動(dòng)態(tài)生成form表單的實(shí)例代碼

    使用Vue動(dòng)態(tài)生成form表單的實(shí)例代碼

    這篇文章主要介紹了使用Vue動(dòng)態(tài)生成form表單的實(shí)例代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2018-04-04
  • vue項(xiàng)目中實(shí)現(xiàn)全局引入jquery

    vue項(xiàng)目中實(shí)現(xiàn)全局引入jquery

    這篇文章主要介紹了vue項(xiàng)目中實(shí)現(xiàn)全局引入jquery方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • vue el-table 動(dòng)態(tài)添加行與刪除行的實(shí)現(xiàn)

    vue el-table 動(dòng)態(tài)添加行與刪除行的實(shí)現(xiàn)

    這篇文章主要介紹了vue el-table 動(dòng)態(tài)添加行與刪除行的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-07-07
  • vue 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子

    vue 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子

    今天小編就為大家分享一篇vue 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-11-11
  • Vue子組件調(diào)用父組件方法案例詳解

    Vue子組件調(diào)用父組件方法案例詳解

    這篇文章主要介紹了Vue子組件調(diào)用父組件方法案例詳解,本篇文章通過(guò)簡(jiǎn)要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下
    2021-09-09
  • Vue實(shí)現(xiàn)模糊查詢搜索功能的步驟詳解

    Vue實(shí)現(xiàn)模糊查詢搜索功能的步驟詳解

    本文主要介紹了Vue實(shí)現(xiàn)模糊查詢搜索功能的步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-10-10
  • Vue核心概念Getter的使用方法

    Vue核心概念Getter的使用方法

    今天小編就為大家分享一篇關(guān)于Vue核心概念Getter的使用方法,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-01-01
  • vue 調(diào)用 RESTful風(fēng)格接口操作

    vue 調(diào)用 RESTful風(fēng)格接口操作

    這篇文章主要介紹了vue 調(diào)用 RESTful風(fēng)格接口操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-08-08

最新評(píng)論