mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
39 lines
890 B
JavaScript
39 lines
890 B
JavaScript
export default {
|
|
data () {
|
|
return {
|
|
showLightBar: false,
|
|
lightBarTop: 0,
|
|
lightBarVanishTimerId: null
|
|
}
|
|
},
|
|
computed: {
|
|
lightBarStyleTop () {
|
|
return this.lightBarTop + 'px'
|
|
}
|
|
},
|
|
beforeDestory () {
|
|
window.clearTimeout(this.lightBarVanishTimerId)
|
|
},
|
|
methods: {
|
|
updateLightBarPosition (el) {
|
|
if (this.active) {
|
|
if (this.lightBarVanishTimerId) {
|
|
window.clearTimeout(this.lightBarVanishTimerId)
|
|
this.lightBarVanishTimerId = null
|
|
}
|
|
this.showLightBar = true
|
|
this.lightBarTop = el.offsetTop
|
|
}
|
|
},
|
|
hideLightBar (delay = 80) {
|
|
window.clearTimeout(this.lightBarVanishTimerId)
|
|
this.lightBarVanishTimerId = window.setTimeout(() => {
|
|
this.showLightBar = false
|
|
}, delay)
|
|
},
|
|
hideLightBarSync () {
|
|
this.showLightBar = false
|
|
}
|
|
}
|
|
}
|