Created
November 8, 2017 09:18
-
-
Save alizhdanov/e398c06c8214a308710540cab968e2db to your computer and use it in GitHub Desktop.
Render vue components from string
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
// IF you need render from string in vue | |
// The beset example is a blog post, where your content are recieving from a server and you don't have control of it. | |
import Vue from 'vue'; | |
import CustomComponent1 from './CustomComponent1.vue' | |
import CustomComponent2 from './CustomComponent1.vue' | |
export default { | |
props: ['res'], | |
components: {CustomComponent1, CustomComponent2}, | |
render(h) { | |
return Vue.compile('<div>'+this.res+'</div>') | |
.render.apply(this, [h]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment