Vue Error: [Vue warn]: Error compiling template:Templates should only be responsible for mapping…

Error message:

[Vue warn]: Error compiling template:Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.

Analysis:

Template compilation error: The template is used as a response to the mapping UI interface. It is forbidden to place side-effect tags in the template, such as <script>, because they will not be parsed.

The summary is that <script> cannot be placed in a template file. But it can actually be placed in a template file.

Solve:

In fact, the <script> tag cannot be included in the <div> tag.

As follows,
image

Under the PyCharm smart labeling error, I found the error, and I lost a </div> tag in my source code.
But the browser mentally added the missing </div> tag before the </body> tag and after the </script> tag. As a result, such a warning occurred. Since a page is a div, this is why the console displays the entire body part of the page.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *