[Vuejs]-How can I know when dialog is shown

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>

Leave a comment