How to get arguments from an Emit to a router-view in Vue

Viewed 22

I'm working in Vue 3, I have a page with a structure like this:

    <dashnav></dashnav>
    <div class="row">
        <div class="col-3">
             <sidebar></sidebar>
        </div>
        <div class="col-9">
            <router-view @status="onStatusChange"></router-link>
        </div>
    </div>

In the methods section:

  onStatusChange (message) {
     console.log("onStatusChange " + message);
  }

In the child component that is called by the route change I have an emit, this.$emit('status', 'My new message');

I am seeing the event being emitted, but the argument is coming back as undefined. Console log looks like: onStatusChange undefined

This structure of passing arguments in the emit works for me when the receiving component is a normal component, but when it's been loaded via the router-view I don't seem to get any arguments. My fall back will be to put the arguments in a store in vuex, but I'm wondering why I don't see argument with the router-view. Thanks!

0 Answers
Related