[Vuejs]-Vue JS router & updating route content dynamically

0๐Ÿ‘

โœ…

The correct way of doing this is actually with props.

This is all detailed in the blog post I wrote on the topic:

https://www.liquidlight.co.uk/blog/article/building-a-vue-v2-js-app-using-vue-router/

With an example being found on jsbin

0๐Ÿ‘

You code is not working as in ListingCompo component, you are initialising the data, but it is not aware of later changes. To have the change reflected later as well, either you need to put watcher on the parent data, or simply have a computed property, which will change whenever your parent data will change.

var ListingCompo = {
    template: '#template',
    data: function () {
        return {            
        }
    },
    computed: {
      records(){
        return  this.$parent.records
     }      
   }
};

Working jsbin.

Leave a comment