亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時間:2023年06月29日 11:31:51   作者:w晚風  
這篇文章主要為大家介紹了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 不能放在自定義組件上,而是放在原來就有的標簽上,所以這里套了一層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的詳細內(nèi)容,更多關于vue控制臺警告的資料請關注腳本之家其它相關文章!

相關文章

最新評論