欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue控制臺警告Runtime directive used on component with non-element root node

 更新時間:2023年06月29日 11:31:51   作者:w晚風(fēng)  
這篇文章主要為大家介紹了vue控制臺警告Runtime directive used on component with non-element root node解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪

控制臺警告提示信息

控制臺警告Runtime directive used on component with non-element root node. The directives will not function as intended.

如下

原因和解決

意思是自定義指令不能放到組件上,而是要放到自有的元素上,也就是這里用到的v-show,v-if 不能放在自定義組件上,而是放在原來就有的標(biāo)簽上,所以這里套了一層div
比如之前的是這樣子,v-show指令用在了自定義組件UserAdd身上,就警告了

<UserAdd v-show="materialType" />

解決

外面套一層不是自定義組件的元素就可以,我這里套了一層div,你也可以嵌套一層template

<div v-show="materialType">
  <UserAdd />
</div>

或者

<template v-show="materialType">
  <UserAdd />
</template>

以上就是vue控制臺警告Runtime directive used on component with non-element root node的詳細(xì)內(nèi)容,更多關(guān)于vue控制臺警告的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論