vue超出一行文字自动向上滚动

<template>
   div.mine__notice(v-if="basicInfo.isNotice" ref="noticeBox") 
     p.notice-text(ref="notices" :style="{'margin-top': -  noticesMarginTop + 'px'}") {{basicInfo.noticeContent}}
</template>
methods: {
  notice () {
    let allNumber = this.$refs.notices.scrollHeight / this.$refs.noticeBox.clientHeight
    let that = this
    if (this.basicInfo.noticeContent && allNumber > 1) {
      that.timer = setInterval(() => {
        if (that.noticesMarginTop >= this.$refs.notices.scrollHeight - 20) {
          that.noticesMarginTop = 0
        } else {
          that.noticesMarginTop++
          // that.noticesMarginTop += this.$refs.noticeBox.clientHeight
        }
      }, 220)
    }
},
发布了21 篇原创文章 · 获赞 3 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/qq_40039641/article/details/103699309
今日推荐