Vuejs nested components

Today, We want to share with you Vuejs nested components.In this post we will show you VueJS access nested component data value, hear for Vuejs nested components with single file components we will give you demo and example for implement.In this post, we will learn about Navigate Nested Child Routes In A Vue.js Web Application with an example.

Vuejs nested components

There are the Following The simple About Vuejs nested components Full Information With Example and source code.

As I will cover this Post with live Working example to develop Vuejs nested components with inline-template, so the vue pass data to component for this example is following below.

Read Also:  Vue.js Binding Fundamentals Using V-Bind Directive

step 1: vuejs Script Code

source Code from main.js

var shopComponent = Vue.extend({
    template: '#shop-component',

    data: function() {
        return {
            products: []
        }
    },

    created: function() {
        this.$http
            .get('/get_products')
            .then(function(products) {
                this.products = products.data;
            }
        );
    }
});

var shopComponentChild = Vue.extend({
    template: '#shop-component-sub_cat',

    props: ['item'],

    data: function() {
        return {
            item: {}
        }
    }
});

Vue.component('shop-component', shopComponent);
Vue.component('shop-component-sub_cat', shopComponentChild);

new Vue({
    el: 'body',
});

Step 2: HTML Part

source Code from index.html

<shop-component></shop-component>

<template id="shop-component">
    <table>
        <thead>
            <tr>
                <th>Name</th>
                <th>URL</th>
            </tr>
        </thead>
        <tbody>
            <tr is="shop-component-sub_cat" v-for="item in products" :item="item"></tr>
        </tbody>
    </table>
</template>

<template id="shop-component-sub_cat">
    <tr>
        <td></td>
        <td>{{ item.name }}</td>
        <td>{{ item.url }}</td>
    </tr>
</template>

Web Programming Tutorials Example with Demo

Read :

Read Also:  File handling READ AND WRITE TEXT FILE IN ASP.NET C#, VB

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Vuejs nested components.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.