Skip to content

Instantly share code, notes, and snippets.

@renoirb
Created August 27, 2018 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renoirb/65a7f7f62f5ebfaee8789875c40263b2 to your computer and use it in GitHub Desktop.
Save renoirb/65a7f7f62f5ebfaee8789875c40263b2 to your computer and use it in GitHub Desktop.
Vue component in a Gist
// const render = Vue.compile('<h1>Hello {{what}}</h1>')
const HelloComponent = Vue.component('greet-component', {template: '<h1>Hello {{what}}</h1>', props: ['what']})
const app = new Vue({template: '<div><greet-component :what="name" /></div>', components: { HelloComponent }, data: {name: 'World'}})
app.$mount()
app.$children[0].$el.textContent // "Hello World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment