runtime-core.esm-bundler.js?d2dd:38 [Vue warn]: Extraneous non-props attributes (title) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. at <ProductTable title="Product List" > at <Home onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <App>
這是我在 Vue 應用程式的 chrome 控制台中遇到的錯誤。下面是我的父視圖元件。我正在嘗試向其中添加多個元件,例如主頁內容和頁腳。
<template> <div class="home"> <ProductTable title="Product List"/> <Footer title="I am the child"/> </div> </template> <script> import ProductTable from '@/components/ProductTable.vue' import Footer from '@/components/Footer.vue' import Functions from '@/components/ProductListFunctions.js' export default { name: 'Home', components: { ProductTable, Footer } } </script>
感謝任何幫助,因為我無法弄清楚。該錯誤只是一個警告,不會影響任何頁面。但如果離開就好了。乾杯。
您應該將
inheritAttrs:false
新增到子元件: