在 Vue 2 中,我有一个自定义路由解决方案,在某些情况下涉及将组件作为 props 传递。
<template>
<div>
<component :is="component" :data="componentData"/>
</div>
</template>
<script>
export default {
props: {
component: {}
componentData: {}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
在 vue 3 中,这会发出警告:“Vue 收到了一个响应式组件”。
有没有办法避免这个警告?是否可以动态添加组件到组件中?
如果您有一组未在 App.components 中全局注册的组件,是否可以在不发出警告的情况下渲染它们?
这是 Vue2 中关于此问题的一个较老的问题: Is it possible to pass a component as props and use it in a child Component in Vue?
请注意,上面的代码在 Vue2 中运行良好,这个问题专门针对 Vue3。
使用 webpack 5 构建 vue 项目抛出错误:“错误:模块属性已从依赖项中删除”
我的理解是 webpack 删除了 vue 所依赖的猴子补丁。: https://github.com/webpack/webpack/issues/8537
有哪些选项可以解决此错误?