-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
How to ignore template tag? #9968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
you should put those templates outside of vue div instead but you can also do <template v-pre type="text/x-template">
<div>hey {{ foo }}</div>
</template> Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂 |
Sorry man, but this doesn't work as needed: it removes |
updated the comment with a demo but you should put the template outside |
It's not the way... I see the problem still exists not only for me... Maybe someone will make the |
I'm not certain on a good use-case for this. When the root Vue component is mounted, there's an expectation that it will control everything within the node that it is attached to. Why do you want to break that convention? If there's a strong use-case I'm sure the maintainers would be inclined to re-open the issue. As it is now though, this seems unnecessary. |
|
That appears to be a proper bug. The node isn't getting attached to the document fragment. |
So, will you help me? |
As @posva suggested: the solution is moving your |
Sorry but nope... I try to use laravel-admin with vue. And there no any way to move |
Here's my use case which lead me to this issueI'm using a web component in vue, since it's allegedly compatible with web components I have a template like this <custom-element-table>
<template>
<thead>
<!-- table head stuff-->
</thead>
<tbody>
<!-- table body stuff-->
</tbody>
</template>
</custom-element-table> from which i would expect DOM like this: <custom-element-table>
#shadow-root
<template> <!-- in slot -->
#document-fragment
<thead>
<!-- table head stuff-->
</thead>
<tbody>
<!-- table body stuff-->
</tbody>
</template>
</custom-element-table> but i get DOM like this, and a non functioning webcomponent: <custom-element-table>
#shadow-root
<thead> <!-- in slot -->
<!-- table head stuff-->
</thead>
<tbody>
<!-- table body stuff-->
</tbody>
</custom-element-table> using v-pre on my custom element will render the template element as expected, but then i can't use any directives, so that is not a usable approach IMO, for the same reason I can't make a vue component or custom element called |
related #9427 |
I have the same use case. My own custom element relies on template tags. And now I can't use it at all. @stephantabor: Did you find any way around it? |
@ukaaa no i didn't, i ended up reimplementing it in vue. It seems that none of the major/popular front end frameworks can handle this at the moment (as you can see here: webcomponents/custom-elements-everywhere#234) |
@stephantabor Too bad. I might look at creating my own template-like element or something. But it will never have the true benefits of a |
Same problem with Vue 3. <body>
... some html
<template id="calendar">
<div class="flex gap-1 items-center">
<x-icon name="calendar" />
...
</div>
</template>
... some html
</body> createApp({
mounted() {
let tpl = document.getElementById('calendar')
document.body.append(tpl.content.cloneNode(true)) //its not working
}
}).mount(document.body)
document.addEventListener('DOMContentLoaded', () => {
let tpl = document.getElementById('calendar')
document.body.append(tpl.content.cloneNode(true)) //works fine
}) So nasty behaviour of Vue. How can disable it? Help me plz :) |
What problem does this feature solve?
Is there the ability to ignore
template
tag? Example: I use standard vue component that contains owntemplate
and other logic. But in the same time on the page othertemplate
tag exists and vue tries to parse it... How to avoid it?What does the proposed API look like?
<template v-ignore>...</template>
The text was updated successfully, but these errors were encountered: