Vuejs2 @vue/cli 4.0.5应用程序2“应用程序”divs中的内容是什么?

Vuejs2 @vue/cli 4.0.5应用程序2“应用程序”divs中的内容是什么?,vuejs2,Vuejs2,在/public/index.html文件中的@vue/cli 4.0.5应用程序中,我看到带有div id=“app”的代码 <body> <noscript> <strong>We're sorry but vtasks doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> </nos

在/public/index.html文件中的@vue/cli 4.0.5应用程序中,我看到带有div id=“app”的代码

  <body>
    <noscript>
      <strong>We're sorry but vtasks doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app" style=" ></div>
    <!-- built files will be auto injected -->
  </body>
这很清楚,但在/src/App.vue文件中,我还看到了id为“App”的div:

<template>
  <div id="app">
    <div id="nav">
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </div>
    <router-view/>
  </div>
</template>

<style lang="scss">
...

这是非常令人困惑的,2个应用程序div怎么办?在/public/index.html中对div进行一些更改,我看到它在我的页面中呈现…

vue cli使用的webpack将vue文件编译到index.html文件中的方式是将vue文件编译到index.html文件中,因此当然您将拥有相同的应用程序基本上webpack从app.vue中获取您的应用程序并将其编译到index.html中。 一般来说,您不希望从索引文件而不是vue文件对vue应用程序进行更改