我一直在我的 vuejs 应用程序上收到此警告,不知道在哪里以及为什么:
build.js:9371 [Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance
我正在使用带有 index.html 的 vue-router:
<body>
<div id="app"></div>
</body>
我一直在我的 vuejs 应用程序上收到此警告,不知道在哪里以及为什么:
build.js:9371 [Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance
我正在使用带有 index.html 的 vue-router:
<body>
<div id="app"></div>
</body>
只是为了补充@Roy J所说的话。查看您的组件。确保你的所有组件都有一个包裹 dom 元素,就像一个单亲一样。最好的做法是将组件中的所有元素包装在一个父 div 中。
像这样的东西:
<div>
<div>Some content</div>
<div> some more content </div>
</div>
这样,Vue 就知道如何在父应用上挂载你的组件。如果你的组件是碎片化的,你会得到你正在谈论的错误。Vue 有时不会准确告诉您哪个组件,因此您必须浏览所有组件。