Vue: Stop template engine from render a block

Created on 12 Jul 2017  ·  3Comments  ·  Source: vuejs/vue

What problem does this feature solve?

If there was a way to stop template compiling from rendering a block in parent Vue instance and instead let another Vue instance or some other template engine do the job like what Django template engine does using verbatim tag. In my case I want to use many Vue instances inside a page and they might be nested. Note that I can't use components because the page is divided into fragments and rendered from different places.

What does the proposed API look like?

I don't know an exact and clean way but I was thinking of something like Django verbatim

Most helpful comment

I'd just avoid mixing templates like this - instead, mount the other instance (with in-js template string) onto an empty element. Either way, I don't think we'd add such an API because the use case is way too niche.

All 3 comments

I think that would result in a lot of code due to the way current virtual dom works. But you can still do something similar if you "transform" your vue apps in custom elements. Then each app will be scoped to it's own shadow dom.

custom elements doesn't solve the problem unless I use ignoredElements of Vue config.

I'd just avoid mixing templates like this - instead, mount the other instance (with in-js template string) onto an empty element. Either way, I don't think we'd add such an API because the use case is way too niche.

Was this page helpful?
0 / 5 - 0 ratings