You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 3, 2018. It is now read-only.
So, with the introduction of Vue2, the compile function has changed a bit, thus I am having difficulties rendering things via compile
Here's my code:
Vue.compile(this.$el.outerHTML);
This is in a VueComponent, where I include some additional HTML templates from separate files via vue-resource, which I then need to render. In Vue 1.x, calling compile also caused the template to re-render, however this does not happen in Vue 2. How can I re-render with the compilefunction now?
The text was updated successfully, but these errors were encountered:
In 2.0, the compile() function does not change the DOM. it only converts the template string into render functions.
Generally, what you should rather do, is something like this:
vartempComponent=newVue({// template string heretemplate: `<div><!-- whatever --></div>`// makes $parent workparent: this// any props the component should receive. // reference to data in the template will *not* have access the the current // components scope, as you create a new componentpropsData:
// possibly other options}).$mount(/*element to mount to here*/)
(Sidenote: Specifically, it confuses me that you seem to want to use the current component's rendered HTML (this.$el.outerHTML) as a template? What should that achieve? the rendered HTML of a component does not contain any template markup for Vue)
So, with the introduction of Vue2, the compile function has changed a bit, thus I am having difficulties rendering things via
compile
Here's my code:
Vue.compile(this.$el.outerHTML);
This is in a VueComponent, where I include some additional HTML templates from separate files via vue-resource, which I then need to render. In Vue 1.x, calling
compile
also caused the template to re-render, however this does not happen in Vue 2. How can I re-render with thecompile
function now?The text was updated successfully, but these errors were encountered: