javascript - What are the differences between the two instantiation methods of Vue?
滿天的星座
滿天的星座 2017-06-12 09:31:01
0
1
728
new Vue({
    router,
    store,
}).$mount('#app')

new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App }
})

What is the difference between these two ways of instantiating Vue?
What is the relationship between the three files main.js, App.vue, and index.html in the project structure?

滿天的星座
滿天的星座

reply all(1)
学霸

First of all, there is no essential difference between these two writing methods, and there is no problem as the entrance to the entire project.

Specifically speaking of the project structure, main.js is the entrance to the entire project (in addition to importing the UI of App.vue, auxiliary libraries and plug-ins such as router/vuex/axios are also imported). App.vue is the entrance to the UI logic. Index.html introduces main.js through the script tag and injects the content of the script execution into #app.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!