diff --git a/src/views/newssection.vue b/src/views/newssection.vue index fa525f9..294c540 100644 --- a/src/views/newssection.vue +++ b/src/views/newssection.vue @@ -47,14 +47,11 @@ export default { }, methods: { scroll() { - let con1 = this.$refs.rollul; - con1[0].style.marginTop = '30px'; this.animate = !this.animate; var that = this; // 在异步函数中会出现this的偏移问题,此处一定要先保存好this的指向 setTimeout(function () { that.list.push(that.list[0]); that.list.shift(); - con1[0].style.marginTop = '0px'; that.animate = !that.animate;  // 这个地方如果不把animate 取反会出现消息回滚的现象,此时把ul 元素的过渡属性取消掉就可以完美实现无缝滚动的效果了 }, 0) } @@ -70,6 +67,7 @@ export default { height: 26px; background-image: url($img); background-repeat:no-repeat ; + background-position: center center ; } .nwwest-roll { width: 100%;