vuejs Dynamic component HTML Templates data

Today, We want to share with you vuejs Dynamic component HTML Templates data.
In this post we will show you vuejs component template data Example, hear for Vue Templates we will give you demo and example for implement.
In this post, we will learn about Building a component based app with Vue with an example.

The Components are one of the most simple and very powerful features of Vue js. They help more then you extend basic level HTML elements DOM element to encapsulate data reusable code. simple logic of At a high level data, many components are simple custom elements differents that Vue’s compiler data of the attaches behavior sample to. In some cases, they all of the may also appear data as a native HTML dom element extended per unit data of the with the special is attribute.

READ :  Vuejs Expressions – Numbers Strings Objects Array eval using Vuejs

The Components are one of the simple most powerful features of Vuejs.

They help sample you extend to the basic HTML DOM elements to more encapsulate reusable all the code.

Syntax of the Vuejs Components

new Vue({
  el: '#some-element',
  // options
})

Passing Data to Components with Props Example

Vue.component('greeting', {
    template: '<h1>{{message}}</h1>',
    props: ['message']
});


index.html



  
  <title></title>
  
      


  <div id="myApp">
  
</div>
  <a href="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js">https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js</a>
    <a href="http://js/index.js">http://js/index.js</a>


index.js

'use strict';

Vue.component('child', {
  props: ['text'],
  template: '<div>{{ text }}<div>'
});

new Vue({
  el: "#myApp",
  data: function data() {
    return {
      message: 'hello mr. magoo'
    };
  }
});

babel/index.babel

Vue.component('child', {
  props: ['text'],
  template: `<div>{{ text }}<div>`
});

new Vue({
  el: "#myApp",
  data() {
    return {
      message: 'Vuejs Hello World My first Simple Example of vue component template.'
    }
  }
});