在非元素根节点上使用的运行时指令。指令将无法正常运作。

huangapple go评论98阅读模式
英文:

Runtime directive used on component with non-element root node. The directives will not function as intended

问题

我正在将Vue2升级到Vue3,但在控制台中收到以下警告:

[Vue warn]: 在具有非元素根节点的组件上使用了运行时指令。指令将无法按预期工作。在 <VNavigationDrawer modelValue=false onUpdate:modelValue=fn app="" > 处;在 <SideBar> 处;在 <VApp id="inspire" > 处;在 <App> 处。

有人有任何想法吗?

英文:

I am upgrading vue2 to vue3 and I get the folowing warning in my console :

[Vue warn]: Runtime directive used on component with non-element root node. The directives will not function as intended. at &lt;VNavigationDrawer modelValue=false onUpdate:modelValue=fn app=&quot;&quot; &gt; at &lt;SideBar&gt; at &lt;VApp id=&quot;inspire&quot; &gt; at &lt;App&gt;

does anyone have any ideas?

答案1

得分: 2

Sure, here's the translated content:

首个在 <template> 中的节点必须是一个 div(或其他有效元素,但 div 对我有效,所以...)

<template>
	<div>
		...
	</div>
</template>

如果你在 <template> 中添加了除包裹的 <div> 外的其他内容,会触发此错误。

我不知道有哪些有问题的节点,但我知道在闭合的 </div> 和闭合的 </template> 之间添加内容会触发此错误。

英文:

First node in the &lt;template&gt; must be a div (or some other valid element, but div works for me, so...)

&lt;template&gt;
	&lt;div&gt;
		...
	&lt;/div&gt;
&lt;/template&gt;

If you add somethins else into <template> but outside of the wrapping &lt;div&gt;, this error occurs.

I do not know what, if any, offending nodes may be, but I do know that adding something between closing &lt;/div&gt; and closing &lt;/template&gt; triggers this error.

huangapple
  • 本文由 发表于 2023年6月6日 03:26:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409457.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定