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

vue實現無限消息無縫滾動

 更新時間:2022年04月08日 11:43:42   作者:過往深處少年藍  
這篇文章主要為大家詳細介紹了vue實現無限消息無縫滾動,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了vue實現無限消息無縫滾動的具體代碼,供大家參考,具體內容如下

一、html

<div class="table_box">
? ?<div class="table_title">
? ? <div class="table_title_item">告警時間</div>
? ? <div class="table_title_item">所屬集中器</div>
? ? <div class="table_title_item" style="width:40%">內容</div>
? ?</div>
? ?<div class="table_content">
? ?<div :class="{anim:animate}" @mouseenter="Stop()" @mouseleave="Up()">
? ? <div class="table_item" v-for="(item, index) in chart4" :key="index">
? ? ?<div class="table_colum" :title="item.wtime">{{item.wtime}}</div>
? ? ?<div class="table_colum" :title="item.terminalName">{{item.terminalName}}</div>
? ? ?<div class="table_colum2" :title="item.remark">{{item.remark}}</div>
? ?</div>
? ?</div>
? ?</div>
</div>

二、style

.table_box{
? ? padding:10px;
}
.table_title_item{
? ? width:30%;
? ? height:28px;
? ? color:#fff;
? ? color:#01C0C3;
? ? font-size: 14px;
? ? line-height: 28px;
? ? text-align: center;
}
.table_content{
? ? margin:5px;
? ? height:28vh;
? ? overflow: hidden;
}
.table_item{
? ? width:100%;
? ? // 設定行高
? ? height:30px;
? ? line-height: 30px;
? ? display: flex;
? ? color:#01C0C3;
? ? font-size:14px;
}
.anim{
? ? // 設定滾動
? ? transition: all 0.5s;
? ? margin-top: -30px;//高度等于行高
}
.table_colum{
? ? width:30%;
? ? text-align: center;
? ? // 多出部分省略
? ? overflow: hidden;
? ? text-overflow: ellipsis;
? ? display: -webkit-box;
? ? -webkit-line-clamp: 1; //行數
? ? -webkit-box-orient: vertical;
}
.table_colum2{
? ? width:40%;
? ? text-align: center;
? ? // 多出部分省略
? ? overflow: hidden;
? ? text-overflow: ellipsis;
? ? display: -webkit-box;
? ? -webkit-line-clamp: 1; //行數
? ? -webkit-box-orient: vertical;
}

三、js

<script>
export default {
? ? data() {
? ? ? ? return {
? ? ? ? ? ? // 告警滾動部分
? ? ? ? ? ? chart4: [],
? ? ? ? ? ? animate: false,
? ? ? ? ? ? intNum: undefined
? ? ? ? }
? ? },
? ? created() {
? ? ? ? this.getAlarmDatas()
? ? },
? ? methods: {
? ? ? ? // 獲取報警數據
? ? ? ? getAlarmDatas() {
? ? ? ? ? ? getAlarmInfo().then(res => {
? ? ? ? ? ? ? ? if (res.code === 1 && res.data.length > 0) {
? ? ? ? ? ? ? ? ? ? this.chart4 = res.data
? ? ? ? ? ? ? ? ? ? this.ScrollUp()
? ? ? ? ? ? ? ? }
? ? ? ? ? ? })
? ? ? ? },
? ? ? ? /** 告警滾動部分 */
? ? ? ? ScrollUp() {
? ? ? ? ? ? // 每次滾動時先清除上次定時器
? ? ? ? ? ? this.Stop()
? ? ? ? ? ? let that = this
? ? ? ? ? ? this.intNum = setInterval(function() {
? ? ? ? ? ? ? ? that.animate = true // 向上滾動的時候需要添加css3過渡動畫
? ? ? ? ? ? ? ? setTimeout(() => {
? ? ? ? ? ? ? ? ? ? that.chart4.push(that.chart4[0]) // 將數組的第一個元素添加到數組的
? ? ? ? ? ? ? ? ? ? that.chart4.shift() // 刪除數組的第一個元素
? ? ? ? ? ? ? ? ? ? that.animate = false
? ? ? ? ? ? ? ? }, 500)
? ? ? ? ? ? }, 2000)
? ? ? ? },
? ? ? ? // 鼠標移上去停止
? ? ? ? Stop() {
? ? ? ? ? ? clearInterval(this.intNum)
? ? ? ? },
? ? ? ? // 鼠標移出
? ? ? ? Up() {
? ? ? ? ? ? this.ScrollUp()
? ? ? ? }
? ? }
}
</script>

四、效果

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

相關文章

  • vue升級之路之vue-router的使用教程

    vue升級之路之vue-router的使用教程

    自動安裝的vue-router,會在src 文件夾下有個一個 router -> index.js 文件 在 index.js 中創(chuàng)建 routers 對象,引入所需的組件并配置路徑。這篇文章主要介紹了vue-router的使用,需要的朋友可以參考下
    2018-08-08
  • vue中的el-form表單rule校驗問題(特殊字符、中文、數字等)

    vue中的el-form表單rule校驗問題(特殊字符、中文、數字等)

    這篇文章主要介紹了vue中的el-form表單rule校驗問題(特殊字符、中文、數字等),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-05-05
  • 淺談vue引入css,less遇到的坑和解決方法

    淺談vue引入css,less遇到的坑和解決方法

    下面小編就為大家分享一篇淺談vue引入css,less遇到的坑和解決方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-01-01
  • Vue.js中的綁定樣式實現

    Vue.js中的綁定樣式實現

    這篇文章主要介紹了Vue.js中的綁定樣式實現,展開的內容呦style綁定樣式和綁定class樣式,具體相關內容需要的小伙伴可以參考下面文章介紹
    2022-05-05
  • Vue中使用matomo進行訪問流量統(tǒng)計的實現

    Vue中使用matomo進行訪問流量統(tǒng)計的實現

    這篇文章主要介紹了Vue中使用matomo進行訪問流量統(tǒng)計的實現,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-11-11
  • Vue項目業(yè)務邏輯模塊介紹

    Vue項目業(yè)務邏輯模塊介紹

    這篇文章主要介紹了Vue項目業(yè)務邏輯,不同的項目有不同的功能,不同的功能需要不同的實現,實現這些核心功能的代碼就叫業(yè)務邏輯。所以說業(yè)務邏輯是指一個實體單元為了向另一個實體單元提供服務,應該具備的規(guī)則與流程
    2022-11-11
  • 詳解vuex數據傳輸的兩種方式及this.$store undefined的解決辦法

    詳解vuex數據傳輸的兩種方式及this.$store undefined的解決辦法

    這篇文章主要介紹了vuex數據傳輸的兩種方式 及 this.$store undefined的解決辦法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-08-08
  • 深度解讀vue-resize的具體用法

    深度解讀vue-resize的具體用法

    這篇文章主要介紹了vue-resize深度解讀,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-07-07
  • vue實現按需加載組件及異步組件功能

    vue實現按需加載組件及異步組件功能

    這篇文章主要介紹了vue實現按需加載組件和異步組件,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值 ,需要的朋友可以參考下
    2019-05-05
  • 基于vue-resource jsonp跨域問題的解決方法

    基于vue-resource jsonp跨域問題的解決方法

    下面小編就為大家分享一篇基于vue-resource jsonp跨域問題的解決方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02

最新評論