Vuejs router.params undefined Vuejs router.params undefined vue.js vue.js

Vuejs router.params undefined


To access the router params, you need to use this.$route.params in your code. Your code should be something like following:

const vc = {  template: '#video-capture' ,  mounted () {    this.init()  },  methods: {    init () {      console.log(this.$route);  //should return object      console.log(this.$route.params); //should return object       console.log(this.$route.params.id); //should return id of URL param     },  }}

Here is working fiddle.