Home » Vuejs nested components

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.

Read Also:  javascript remove last comma from Array

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.

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

Read Also:  Vuejs Double Click to inline editing vue Grid Component

<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 :

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.

Read Also:  Top 10 Common PHP Job Interview Questions and Answers

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Handling Events and Methods using VueJS
  2. Read Also:  Form Input Bindings in vue.js
  3. Read Also:  Vue.js Binding Fundamentals Using V-Bind Directive
  4. Read Also:  how to disable previous date in bootstrap datepicker?
  5. Read Also:  VueJS nested child, template, inner template, components
  6. Read Also:  Laravel Deleting Records From MySQL Table
  7. Read Also:  How to Check If String Contains a Substring in PHP
  8. Read Also:  Laravel 5.7 CRUD Tutorial With Example from scratch
  9. Read Also:  Create Animated Scroll To Top Button using jQuery
  10. Read Also:  Laravel Calculate Difference Between Two Dates

Leave a Comment

Your email address will not be published. Required fields are marked *