在 src/App.vue 中为什么删除了<div id="App"></div>,程序还能正常运行呢?

在main.js中,设置了挂载点el:'#app',现在我们在App.vue中又换成了class='container',程序还能正常运行,这是为什么呢?谢谢指教

new Vue({
  el: '#app',
  components: { App },
  template: '<App/>'
})
<template>
  <div class="container">
    ...
  </div>
</template>
zs4336
最佳答案

入口文件 index.html 中有挂载 vue 实例的 div 容器

4年前 评论
讨论数量: 2
zs4336

入口文件 index.html 中有挂载 vue 实例的 div 容器

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!