MattCCC / nativescript-vue-router-extended

A simple Router for NativeScript-Vue, built on top of $navigateTo so to simplify routing between the pages
https://npmjs.org/package/nativescript-vue-router-extended
Apache License 2.0
20 stars 3 forks source link

Pass props not working #2

Closed vallemar closed 3 years ago

vallemar commented 3 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

I am trying to pass props to a page and it is not working for me. I have tried it like this:

methods:{
    toLogin(){
      this.$routeTo("/login" , { props: { successRedirect: '/home'}});
    }
  }

and so

import {useRouter} from "nativescript-vue-router-extended";

setup(){
    const router = useRouter()
    const toLogin = () =>{
      router.push("/login" , { props: { successRedirect: '/home'}})
    }
    return { toLogin }
}

I have also set props to true in the routes just in case

const routes = [
  {
    path: "/login",
    component: Login,
    props: true
  },
];
MattCCC commented 3 years ago

Hi, thanks for filing the issue. What does your createRouter function look like? Also does the redirection happen at all, just without props or not at all? Do you get any info when launching ns debug android in terminal?

MattCCC commented 3 years ago

I'm unable to reproduce this issue. In my setup props are passed correctly. Can you make a demo app with this issue reproduce? I will test it out then and push fix asap if needed.

vallemar commented 3 years ago

@MattCCC I think it was my mistake, now I'm refactoring the code a lot and can't test it. I confirm when the refactor finishes. Thank you! and another thing, useRouter is sublime!

MattCCC commented 3 years ago

Sure, no worries. I gave it a few more tries but seems to be working just fine so far. Edit/ let me know once u test it pls, thanks 👍

MattCCC commented 3 years ago

Also, one more thing, may be a stupid question but do you register prop inside of your Login ? Something like:

image

vallemar commented 3 years ago

The problem was that I was in a tabbed view, and I had put the props on the first tab. She had not realized that the page was the father. Sorry!!!!