Vuejs :is example

In this example below you will see how to do a Vuejs :is example with some HTML / CSS and Javascript

This awesome code was written by ColdToast, you can see more from this user in the personal repository.
You can find the original code on
Copyright ColdToast ©


  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>Vuejs :is example</title>
    <link rel="stylesheet" href="">



  <div id="example">
    name="Not Mike"
  <button @click="activeControl = 'b-component'">Click me</button>
  <script src=''></script>


    <script  src="js/index.js"></script>



/*Downloaded from */
// register
Vue.component('a-component', {
  template: '<div>{{name}} does this work?</div>',
  props: {
    'name': {
      type: String,
      required: true

Vue.component('b-component', {
  template: '<div>B component!</div>'

// create a root instance
new Vue({
  el: '#example',
  data: function data() {
    return {
      activeControl: 'a-component'