Home>

I get a [Vue warn]: Cannot find element: app error in Vue.js
web framework is rails
Hopefully it will be displayed as Hello.

How to install Vue.js

Related files

index.html


<p>{{message}}</p>

<script src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<% = javascript_pack_tag'top_vue'%>

app/javascript/packs/top_vue.js

var app = new Vue ({{
  el:'app',
  data: {
    message: "Hello"
  }
})
error
[Vue warn]: Cannot find element: app
warn @ vue.js: 634
query @ vue.js: 5666
Vue. $Mount @ vue.js: 11882
Vue._init @ vue.js: 5012
Vue @ vue.js: 5078
./app/javascript/packs/top_vue.js @ top_vue.js: 1
__webpack_require__ @ bootstrap: 19
(anonymous) @ bootstrap: 83
(anonymous) @ bootstrap: 83
Consideration
<script src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>


Is there a cause?

<% #<script src = "https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script>%>


I tried changing it to, but the same error statement occurred at 1 warring and it did not change