Skip to content
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

v-pre do not work in template tags #8041

Closed
msassa opened this issue Apr 17, 2018 · 7 comments · Fixed by #8146
Closed

v-pre do not work in template tags #8041

msassa opened this issue Apr 17, 2018 · 7 comments · Fixed by #8146

Comments

@msassa
Copy link

msassa commented Apr 17, 2018

Version

2.5.7

Reproduction link

https://jsfiddle.net/3s9sem0m/

Steps to reproduce

I am using laravel-admin.org and I have incorporated vuejs into that system. The problem is that there are some functionalities that use the tag template, to then duplicate it using jquery, and vuejs are rendering those tags (even if you add the v-pre directive) and breaking all that functionality.

What is expected?

The directive v-pre should prevent render the tag template

What is actually happening?

The tag template is rendered and disappears, preventing the later use of the js script and breaking all the functionality

@posva
Copy link
Member

posva commented Apr 17, 2018

It works fine on the fiddle you posted. I'll revisit if you add correct steps to reproduce and fix the repro. Thanks

@posva posva closed this as completed Apr 17, 2018
@msassa
Copy link
Author

msassa commented Apr 17, 2018

How is working fine if the template tag is missing in the source
image

I need the template tag remain in the source code to use it from Jquery later ... that is how the laravel-admin works.

@msassa
Copy link
Author

msassa commented Apr 17, 2018

Even if I put the template tag inside a div with v-pre, the tag is rendered and missing
image

https://jsfiddle.net/zct418xa/1/

@posva
Copy link
Member

posva commented Apr 17, 2018

Ah, didn't get what you said in the first place. Not sure if this a good idea because template has a special meaning in html. For the moment you can use v-html to completely escape the HTML but v-pre should indeed leave the template during compilation phase

@posva posva reopened this Apr 17, 2018
@msassa
Copy link
Author

msassa commented Apr 17, 2018

Hi, the use that I am giving to the template tag is the one that should be, but outside of vuejs, and that is exactly the problem.

Using the v-html works. Is too complicate, but works.
https://jsfiddle.net/ft53kwrw/

image

It would by nice and easier if v-pre works in the template tag.

Thanks

@leopiccionia
Copy link

I'm not familiar with laravel-admin. Does script type="text/x-template" solve your problem?

https://vuejs.org/v2/guide/components-edge-cases.html#X-Templates

@msassa
Copy link
Author

msassa commented Apr 18, 2018

Maybe should work. But the template tag, is inside a blade file, and if a put a script inside the root vue element, I get another warning. So, I think for the moment v-html is the best way. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants