感谢:https://blog.csdn.net/qq_35624642/article/details/78243413

index.html

<body>
    <div id="app"></div>
    <!-- built files will be auto injected --> 
</body>

 

App.vue

<template>
  <div id="app">
    <h1 class="title">头部</h1>
    <router-view></router-view>
  </div>
</template>

 

main.js

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

 

 

在main.js的初始化中,el:'#app'到底绑定的是哪个文件中的id='app'

 答:将index.html的元素

 

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2021-08-21
  • 2021-11-08
  • 2021-11-09
  • 2022-12-23
  • 2022-02-02
猜你喜欢
  • 2022-12-23
  • 2021-04-05
  • 2021-06-28
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
相关资源
相似解决方案