【发布时间】:2019-12-02 13:24:40
【问题描述】:
我最近将我的项目中的 laravel mix 更新到最新版本,我立即被 Vue 错误所包围。我似乎特别在这个问题上挣扎。我有一个组件:
<template>
<div>
<ChildComponent :context="this"></ChildComponent>
</div>
</template>
<script>
import ChildComponent from './child-component';
export default {
components: { ChildComponent },
...
}
</script>
这是我得到的错误:Error in render: "TypeError: Cannot read property 'context' of undefined"。
看起来很奇怪,因为在 vue-devtools 中,父组件作为对象存在于 ChildComponent 的 context 属性中。
我可能还应该添加上下文在 ChildComponent 的道具中定义为 context: {}。
【问题讨论】:
标签: javascript vue.js laravel-mix