Created
January 9, 2018 12:32
-
-
Save jacobwyke/b7d4f92c45cab9d3181a334d89e7478c to your computer and use it in GitHub Desktop.
Vue.js render function template component with multiple child nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('greeting', { | |
//Renders: | |
//<div> | |
// <h1>Hello World!</h1> | |
// <p>Welcome to Vue.js</p> | |
// <p>A <a href="foo/bar.html">link</a> within a sentence.</p> | |
//</div> | |
render(createElement) { | |
return createElement( | |
'div', | |
[ | |
createElement('h1', 'Hello World!'), | |
createElement('p', 'Welcome to Vue.js'), | |
createElement('p', | |
[ | |
'A ', | |
createElement( | |
'a', | |
{ | |
attrs: { | |
'href': 'foo/bar.html' | |
} | |
}, | |
'link' | |
), | |
' within a sentence.' | |
] | |
), | |
] | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output at: https://gist.github.com/jacobwyke/d91dd26493282c42093233d3cc8fd9d5