0👍
I also use Eventbus to make event fire.
Still don’t understand to make event fire and access its DOM
<v-dialog ref="alarmModal" easer>
<v-card-text ref="alarmModalPrices" style="height:300px">
</v-card>
</v-dialog>
<script>
import { EventBus } from '../plugins/event-bus'
export default {
mounted(){
this.$refs.alarmModal.show = function () {
EventBus.$emit('fire') // <-- work
}
}
updated(){
this.$nextTick(function () {
this.$refs.tempAlarmPrices.scrollTop = 300 // <-- work
console.log(this.$refs.tempAlarmPrices.scrollTop) // return 300
var root = this
EventBus.$on('fire', function () { // <-- called when event fired
root.$refs.tempAlarmPrices.scrollTop = 500 // <-- not work
console.log(root.$refs.tempAlarmPrices.scrollTop) // return 0
})
})
}
}
</script>
- [Vuejs]-4 deep level folder not working "../../../../config.js" in vue component
- [Vuejs]-Export "mdbDatePicker" was not found in "mdbvue"
Source:stackexchange.com