" />

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

vue使用動畫實現(xiàn)滾動表格效果

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

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

需求

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

vue代碼如下

<template>
? <div style="cursor: default;margin:9px 10px 18px">
? ? <div class="table-header table-row">
? ? ? <div class="table-cell" style="width: 25%">計劃名稱</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>

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

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • vue中使用TypeScript的方法

    vue中使用TypeScript的方法

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

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

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

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

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

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

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

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

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

    vue 導航內容設置選中狀態(tài)樣式的例子

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

    Vue子組件調用父組件方法案例詳解

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

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

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

    Vue核心概念Getter的使用方法

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

    vue 調用 RESTful風格接口操作

    這篇文章主要介紹了vue 調用 RESTful風格接口操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08

最新評論