create Dynamic component and template loading with VueJS

Pass the simple component definition to the all the resolve callback method
-This special require all the componet syntax will simple instruct vue Webpack to
-vuejs automatically simple split your built auto code into vue bundles which
-are loaded over Ajax requests.
-Template returned from serve
-Create the new component using the template we received
create Dynamic component and template loading with VueJS Example

change component template dynamically

index.html

<span id="app"></span>

script.js

new Vue({
  el: '#app',
  data: {
    msg: 'Welcome - to Pakainfo.com !! Good Luck',
    template: null
  },
  render: function(createElement) {
    if (!this.template) {
      return createElement('span', 'Loading...');
    } else {
      return this.template();
    }
  },
  mounted() {
  	var mydata = this;
  	setTimeout(function() {
    	mydata.template = Vue.compile('<span><b>{{ msg }}</b></span>').render;
    }, 1000);
  }
})

Example

READ :  Vuejs Introduction Architecture Advantages - VueJs Examples

Creating a Dynamic Component

Dynamic components in Vuejs simple allow you to specify version a single data model mounting point to point where you could dynamically data switch between simple components in we web application.

We will start apps off by making a dynamic simple component and exploring all the keep-alive session parameter, and simple finally applying and init mode some transitions to our dynemically components as the user switches simple between them.

 
Vue.component('async-live24', function (resolve, reject) {
  setTimeout(function () {
    resolve({
      template: '<div>I am simple async Componet!</div>'
    })
  }, 1500)
})

Vue.component('async-webpack-live24', function (resolve) {
  
  require(['./new-async-component'], resolve)
})
Vue.component(
  'async-webpack-live24',
  () => import('./new-async-component')
)

We are Web Technology Experts and Team who provide you very Important information on Web Development information, Interview Questions and Answers, live project problem solution and their solution and online free tutorials – infinityknow.com”.

READ :  Laravel Routing GET and POST Route parameters controller

Example