130๐
You can use script tag in this way and it will work fine.
I was facing the same problem when I used <script></script>
tag without specifying its type.
After using the type attribute Vue did not warn me for critical error:
<script type="application/javascript">
// your code
</script>
39๐
I think the answer is in you question title. Just get rid of all the <script>
tags in the template, put them outside of the template.
In this case you are using body
as the template and you are putting scripts inside your template (body
)
The easy solution is to change the el: 'body'
to el: '#wrapper'
and edit your html to
<body>
<div id="wrapper">
...
</div>
<script ... >
<script ... >
</body>
- [Django]-Django admin default filter
- [Django]-Django: How to get related objects of a queryset?
- [Django]-Explicitly set MySQL table storage engine using South and Django
18๐
Make sure you have a closing tag on your root element.
I just spent the last 6 hours systematically removing things and pulling my hair out. Turns out I had deleted my closing at some point and Vue was interpreting
- [Django]-Unique fields that allow nulls in Django
- [Django]-Making django server accessible in LAN
- [Django]-Form with CheckboxSelectMultiple doesn't validate
15๐
a pair of mismatched tags (div, span) can cause this error.
<div id="app">
<div>{{ a }} </span>
</div>
- [Django]-'pip' is not recognized as an internal or external command
- [Django]-Django : How can I find a list of models that the ORM knows?
- [Django]-How do Django models work?
6๐
It is because of script tag in your app scope. In my case it was because of google captcha that was in my scope. Google captcha iframe contains script tag
- [Django]-Django โ FileField check if None
- [Django]-How to get request object in django unit testing?
- [Django]-How to specify the login_required redirect url in django?
3๐
VueJs doesnโt allow inside the appโs component. For Example,`
<body>
<div id="vue-id">
<!-- Ways of calling to templates-->
<h2>{{ message }}</h2>
<h2 v-text="message"></h2>
<h3>{{ value * 5 }}</h3>
<h3>{{ value }}</h3>
<script></script>
</div>
</body>`
where is inside the same [ appโs component]
The right option is to include outside the appโs component`
<body>
<div id="vue-id">
<!-- Ways of calling to templates-->
<h2>{{ message }}</h2>
<h2 v-text="message"></h2>
<h3>{{ value * 5 }}</h3>
<h3>{{ value }}</h3>
</div>
<script></script>
</body>
- [Django]-Django set default form values
- [Django]-Numeric for loop in Django templates
- [Django]-How to redirect to previous page in Django after POST request
2๐
My suggestion is a little specific, as Iโm using Vue JS v2 in conjunction with jQuery v3.
Iโm using jQuery to load the instance of my application with something simple like this:
$(() => {
new Vue({
name: 'MyApp',
el: '#app' // which is my main HTML element for my entire page app
});
});
So, this wonโt initiate until the entire document is loaded.
In my footer, Iโm changing any offending script tags with this before the entire document is loaded, but after my closing main HTML tag:
$('main script:not([type="application/javascript"])').attr('type', 'application/javascript');
This did the trick for me without having to parse any output from offending tags and doing anything more extravagant.
This can be extrapolated out, using the native document selectors if youโre not using jQuery, like my example.
- [Django]-Django model manager objects.create where is the documentation?
- [Django]-Problems with contenttypes when loading a fixture in Django
- [Django]-Get all related Django model objects
1๐
(Edit first check for mismatched/unclosed tags within your template, as others have said. Vue can be very picky with that)
Might be a simple as an explicit closure of the componentโs tag:
Version: vue@2.6.11
Error there:
...body html...
<bme-form-projval
show_debug_elements="Y"
form_name="batchform"
>
...body html...
still there:
<bme-form-projval
show_debug_elements="Y"
form_name="batchform"
/>
Error solved:
<bme-form-projval
show_debug_elements="Y"
form_name="batchform"
>
</bme-form-projval>
- [Django]-How to write a unit test for a django view?
- [Django]-Can you change a field label in the Django Admin application?
- [Django]-Django can' t load Module 'debug_toolbar': No module named 'debug_toolbar'
- [Django]-Django migrations RunPython not able to call model methods
- [Django]-Getting Django admin url for an object
- [Django]-How to convert JSON data into a Python object?
1๐
Although changing "script" to "script type="application/javascript"" makes the warning disappeared, it causes the page not to finish loading. Therefore, it would not be a good idea to use it!
- [Django]-Pycharm error Django is not importable in this environment
- [Django]-Where to put business logic in django
- [Django]-Count frequency of values in pandas DataFrame column
0๐
This code generate this error too!
<!--[if lte IE 8]>
<div>...</div>
<![endif]-->
- [Django]-Django runserver permanent
- [Django]-Is it better to use path() or url() in urls.py for django 2.0?
- [Django]-Not able to create super user with Django manage.py
0๐
In my case (using Laravel layout) the problem was that i put the footer containing the script inside the div i.e. id="app"
Changing the placement of it outside the div solved the issue.
- [Django]-Creating my own context processor in django
- [Django]-Django Rest Framework and JSONField
- [Django]-Django.db.utils.ProgrammingError: relation "bot_trade" does not exist
0๐
If you look at the end of the error it will tell you how many div's
you have to close before the vue script
2247| </script></div>
| ^^^^^^^^^^^^^^^2247| </script></div>
| ^^^^^^^^^^^^^^^
- [Django]-Scoped_session(sessionmaker()) or plain sessionmaker() in sqlalchemy?
- [Django]-Using {% url ??? %} in django templates
- [Django]-Manager isn't available; User has been swapped for 'pet.Person'
-1๐
Check your browser source code, maybe something else has been added to the framework you are using.
In my case, I did not remove the rails layout template.
- [Django]-Multiple Database Config in Django 1.2
- [Django]-How to make two django projects share the same database
- [Django]-Creating a dynamic choice field