framework7io / framework7-vue

Deprecated! Build full featured iOS & Android apps using Framework7 & Vue
http://framework7.io/vue/
MIT License
674 stars 151 forks source link

Pass parameter in f7-link #420

Closed RickoRo closed 5 years ago

RickoRo commented 6 years ago

Hi!

I'm using version 2.2.1 of framework7-vue.

This is my app initialization

...
new Vue({
  el: '#app',
  template: '<app/>',
  framework7: {
    id: 'io.framework7.testapp',
    name: 'Framework7',
    theme: 'auto',
    routes: Routes,
  },
  components: {
    app: App
  }
});
...

And routes are defined like this:

export default [
...
  {
    path: '/customer/edit/:customerId/',
    component: CustomerEdit,
  },
...

And in the CustomerList I include a f7-link like this:

<f7-link :href="customer | toUrl">Edit</f7-link>

with filter

filters: {
      toUrl(customer) {
        return "/customer/edit/" + customer._id + "/";
      }
    },

How can I access the parameter customerId in CustomerEdit-Component? The property customerId is not shown in this.$f7.router.params.

nolimits4web commented 6 years ago

In your toUrl filter, where did you get customer._id from?

RickoRo commented 6 years ago

Sorry, I was replacing the real code into example code and forgot this. I have a v-for-loop and customer is the list element.

nolimits4web commented 6 years ago

What I also see it must be $f7.route.params.customerId instead of $f7.rouerR