Demo entry 6660537

vue component

   

Submitted by anonymous on Nov 15, 2017 at 22:30
Language: JavaScript. Code size: 338 Bytes.

Vue.component('simple-counter', {
  template: '<button v-on:click="counter += 1">{{ counter }}</button>',
  // data is technically a function, so Vue won't
  // complain, but we return the same object
  // reference for each component instance
  data: function () {
    return { counter: 0 };
  },
})
new Vue({
  el: '#app',
})

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).