Khandaker Toihidul Islam
Software Engineer
Backend : PHP | Mysql | Symfony | CakePhp | Wordpress | Drupal
Frontend : Node js | Vue js | React Js | Javascript | HTML | CSS | Bootstrap
Tools , Server : Nginx | Apache | Git | Jenkins | Jira | Asana | Silenium | Spira

Register component locally

<div id="app" class="text-center">
  <my-component></my-component>
  <my-component></my-component>
</div>

<div id="app2" class="text-center">
  <my-component></my-component>
</div>

<script type="text/javascript">
	// register
	var cm = {
		data: function(){
			return{
				status: 'Critical'
			}
		},
		template : "<p> Server Status: {{ status }} <button @click='changeStatus'>Click</button> </p>",
		methods: {
			changeStatus: function(){
				this.status = 'Normal';
			}
		}
	};

	new Vue({
	  el: '#app',
	  components: {
	  	'my-component' : cm
	  }
	})

	new Vue({
	  el: '#app2'
	})
</script>

Demo http://vue.toihid.com/section-7/register-component-locally.php

You may also like...

Leave a Reply

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