Vue: Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>

Created on 2 Dec 2016  Â·  6Comments  Â·  Source: vuejs/vue

Because the page body in the

All 6 comments

You should follow the Issue Reporting Guidelines to provide enough information for the issue.


Seems that you mount the Vue instance el to your body element? It's not recommended. You could refer https://vuejs.org/v2/api/#el

You could do as bellow

const vm = new Vue({
  'el': '#app'
})
<body>
  <div id="app"></div>
  <script src="path/to/your/script"></script>
</body>

Do not use Vue on <body> - there should've been a warning if you did that.

Try to close out your divs properly.

It'd be nice if Vue throws an error for unclosed tags, like with JSX. That would improve developer experience.

@trusktr It does?
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franciscolourenco picture franciscolourenco  Â·  3Comments

finico picture finico  Â·  3Comments

Jokcy picture Jokcy  Â·  3Comments

robertleeplummerjr picture robertleeplummerjr  Â·  3Comments

julianxhokaxhiu picture julianxhokaxhiu  Â·  3Comments