【发布时间】:2017-07-27 01:53:46
【问题描述】:
我正在尝试让 Vue 组件在 Laravel 5.3 中工作,我想将数据从刀片模板传递到 Vue 组件。
但我遇到了一个错误,到目前为止我找到的答案都没有奏效。
我正在使用全新安装附带的示例组件。在我的刀片模板中,我有:
<example :testinfo="someinfo"></example>
在我的 Example.vue 中我有:
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
{{testinfo}} I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: ['testinfo'],
mounted() {
console.log('Component ready.')
}
}
</script>
Vue 组件确实加载了,但它不显示 testinfo,并生成以下错误消息:
属性或方法“someinfo”未在实例上定义,但 在渲染期间引用。确保声明反应数据 数据选项中的属性。 (在根实例中找到)
【问题讨论】:
标签: laravel-5 vue.js vue-component