Commit 69ef975a by 李伟康

修改滚动样式

1 parent a72668cf
<template> <template>
<div class="group-list"> <div class="group-list" ref="groupBox">
<div class="mask"></div> <div class="mask"></div>
<template v-if="list.length"> <template v-if="list.length">
<div <div
...@@ -43,16 +43,17 @@ export default { ...@@ -43,16 +43,17 @@ export default {
setList (list) { setList (list) {
this.list = list this.list = list
this.$nextTick(() => { this.$nextTick(() => {
let boxHeight = this.$refs.groupBox
let [item] = document.getElementsByClassName('group-item') let [item] = document.getElementsByClassName('group-item')
let itemHeight = item.offsetHeight / 7 + item.offsetHeight let itemHeight = item.offsetHeight / 7 + item.offsetHeight
let groupHeight = `${itemHeight * (list.length - 7)}` let groupHeight = `${itemHeight * (list.length)}`
let rule = `@keyframes rowup { let rule = `@keyframes rowup {
0% {transform: translateY(0);} 0% {transform: translateY(${boxHeight.offsetHeight}px);}
100% {transform: translateY(-${groupHeight}px);} 100% {transform: translateY(-${groupHeight}px);}
}` }`
let sheet = document.styleSheets[0] let sheet = document.styleSheets[0]
sheet.insertRule(rule, 0) sheet.insertRule(rule, 0)
let speed = 2 * list.length let speed = 2 * list.length + 14
// linear // linear
this.$refs.move.style.animation = `${speed}s rowup linear infinite normal` this.$refs.move.style.animation = `${speed}s rowup linear infinite normal`
// this.move() // this.move()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!