fixed bug

This commit is contained in:
jiaming743 2019-01-10 19:03:02 +08:00
parent 41c2d0e860
commit 527cdd6fa3
2 changed files with 17 additions and 12 deletions

View File

@ -24,12 +24,12 @@
v-for="(info, ii) in row.data" v-for="(info, ii) in row.data"
:key="info + Math.random()"> :key="info + Math.random()">
<div :class="`rii-width ${ii === 0 && index && 'index-container'}`" :style="`width: ${columnTrueWidth[ii]};`"> <div @click="emitClickEvent(row, ii)" :class="`rii-width ${ii === 0 && index && 'index-container'}`" :style="`width: ${columnTrueWidth[ii]};`">
<template v-if="ii === 0 && index"> <template v-if="ii === 0 && index">
<div class="index" :style="`background-color:${titleTrueBG};`">{{ info }}</div> <div class="index" :style="`background-color:${titleTrueBG};`">{{ info }}</div>
</template> </template>
<span @click="emitClickEvent(row.data, ii)" v-else v-html="info" /> <span v-else v-html="info" />
</div> </div>
</div> </div>
@ -49,7 +49,8 @@ export default {
container: '', container: '',
containerWH: [], containerWH: [],
animationHandler: '', reAnimationTimer: '',
doFadeTimer: '',
defaultRowNum: 5, defaultRowNum: 5,
defaultTitleBG: '#00BAFF', defaultTitleBG: '#00BAFF',
@ -220,7 +221,7 @@ export default {
const { doFade, waitTime, defaultWaitTime } = this const { doFade, waitTime, defaultWaitTime } = this
setTimeout(doFade, waitTime || defaultWaitTime) this.doFadeTimer = setTimeout(doFade, waitTime || defaultWaitTime)
}, },
doFade () { doFade () {
const { rowTrueNum, carousel, scrollData, allRowNum, currentIndex } = this const { rowTrueNum, carousel, scrollData, allRowNum, currentIndex } = this
@ -241,17 +242,16 @@ export default {
const { getCurrentScrollData } = this const { getCurrentScrollData } = this
this.animationHandler = setTimeout(getCurrentScrollData, 1000) this.reAnimationTimer = setTimeout(getCurrentScrollData, 1000)
}, },
emitClickEvent (rowData, columnIndex) { emitClickEvent ({ data, index }, columnIndex) {
this.$emit('click', { rowData, columnIndex }) this.$emit('click', { data, rowIndex: index, columnIndex: columnIndex + 1 })
}, },
stopAnimation () { stopAnimation () {
const { animationHandler } = this const { reAnimationTimer, doFadeTimer } = this
if (!animationHandler) return reAnimationTimer && clearTimeout(reAnimationTimer)
doFadeTimer && clearTimeout(doFadeTimer)
clearTimeout(animationHandler)
} }
}, },
mounted () { mounted () {

View File

@ -41,7 +41,7 @@ textAlign: ['center', 'center']
<border-box-7 class="other-item"> <border-box-7 class="other-item">
<div class="component"> <div class="component">
<scroll-board :data="scrollBoardData2" carousel="page" :columnWidth="[50, 50]" :textAlign="['center', 'center']" /> <scroll-board @click="test" :data="scrollBoardData2" carousel="page" :columnWidth="[50, 50]" :textAlign="['center', 'center']" />
</div> </div>
<div class="config-info"> <div class="config-info">
@ -232,6 +232,11 @@ export default {
title: ['姓名', '性别', '地址'] title: ['姓名', '性别', '地址']
} }
} }
},
methods: {
test (e) {
console.error(e)
}
} }
} }
</script> </script>