Is it possible to emit from mounted in Vuejs?

Viewed 9436

I am familiar with emitting data via bus on events and these work great but now I want to emit something but I don't have an event to tie it to.

I've tried to emit it on mounted but that hasn't worked as below:

mounted(){
  bus.$emit('send-test', this.test);
},
2 Answers

$nextTick may also be useful, it solved one of my issues and can be used like this

async mounted() {
  await this.$nextTick()
  // Code that will run only after the entire view has been rendered
}
Related