From 527cdd6fa3a20eb8f3104fd74707002385a4e3bc Mon Sep 17 00:00:00 2001 From: jiaming743 <743192023@qq.com> Date: Thu, 10 Jan 2019 19:03:02 +0800 Subject: [PATCH] fixed bug --- src/components/scrollBoard/index.vue | 22 +++++++++++----------- src/views/demo/other.vue | 7 ++++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/scrollBoard/index.vue b/src/components/scrollBoard/index.vue index d3a0d6f..2aefd82 100644 --- a/src/components/scrollBoard/index.vue +++ b/src/components/scrollBoard/index.vue @@ -24,12 +24,12 @@ v-for="(info, ii) in row.data" :key="info + Math.random()"> -
+
- +
@@ -49,7 +49,8 @@ export default { container: '', containerWH: [], - animationHandler: '', + reAnimationTimer: '', + doFadeTimer: '', defaultRowNum: 5, defaultTitleBG: '#00BAFF', @@ -220,7 +221,7 @@ export default { const { doFade, waitTime, defaultWaitTime } = this - setTimeout(doFade, waitTime || defaultWaitTime) + this.doFadeTimer = setTimeout(doFade, waitTime || defaultWaitTime) }, doFade () { const { rowTrueNum, carousel, scrollData, allRowNum, currentIndex } = this @@ -241,17 +242,16 @@ export default { const { getCurrentScrollData } = this - this.animationHandler = setTimeout(getCurrentScrollData, 1000) + this.reAnimationTimer = setTimeout(getCurrentScrollData, 1000) }, - emitClickEvent (rowData, columnIndex) { - this.$emit('click', { rowData, columnIndex }) + emitClickEvent ({ data, index }, columnIndex) { + this.$emit('click', { data, rowIndex: index, columnIndex: columnIndex + 1 }) }, stopAnimation () { - const { animationHandler } = this + const { reAnimationTimer, doFadeTimer } = this - if (!animationHandler) return - - clearTimeout(animationHandler) + reAnimationTimer && clearTimeout(reAnimationTimer) + doFadeTimer && clearTimeout(doFadeTimer) } }, mounted () { diff --git a/src/views/demo/other.vue b/src/views/demo/other.vue index 911ed60..0367ae3 100644 --- a/src/views/demo/other.vue +++ b/src/views/demo/other.vue @@ -41,7 +41,7 @@ textAlign: ['center', 'center']
- +
@@ -232,6 +232,11 @@ export default { title: ['姓名', '性别', '地址'] } } + }, + methods: { + test (e) { + console.error(e) + } } }