gpt4 book ai didi

vuejs2 - 类型错误 : Cannot read property 'components' of undefined in Vue2

转载 作者:行者123 更新时间:2023-12-04 14:29:27 25 4
gpt4 key购买 nike

我在 app.vue 的子集组件中使用 mixins 没有任何问题,一切都很好并且工作正常,但是当我想在 app.vue 组件中使用它时,我在控制台中出现错误。

<script>
/* eslint-disable */
import PanelUser from "./layouts/PanelUser";
import Auth from "./mixins/Auth";
export default {
name: "App",
mixins: [Auth],
components: {
PanelUser
},
};
</script>

error

我也用不了路由器;当我使用它时,页面完全是白色的,没有显示任何内容。

最佳答案

我已经找到了如何检查这种情况。

首先,您可以看到错误抛出 检查组件 方法,移动鼠标并左键单击。

enter image description here

二、添加断点 ,然后刷新页面。

enter image description here

第三,也许你会发现一些被引用的 mixin 或组件显示未定义 .
就我而言,第二个 mixin 未定义。

enter image description here

最后,检查引用或混合文件 .我发现原因是我从另一个文件中复制了mixin,而忘记在声明部分重命名mixin。

enter image description here

仅此而已,尝试自己检查。 :)

关于vuejs2 - 类型错误 : Cannot read property 'components' of undefined in Vue2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55672109/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com