我試圖編寫一個Basic vue腳本,但它在某種程度上在我的larave blade模板中不起作用。Laravel刀片上的Vuejs
我得到這個錯誤:
app.js:32753 [Vue warn]: Property or method "message" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties .
(found in)
到目前爲止的代碼:
@extends('layouts.app')
@section('content')
<div id="foo">
@{{ message }}
</div>
@endsection
@section('javascript')
<script>
new Vue({
el: '#foo',
data: {
message: 'Hello Vue!'
}
})
</script>
@endsection
看不到有什麼不對,也許你已經在別處定義的VUE實例,它看起來對於那個消息。 –
您的vue.js文件在哪裏導入。把它放在寫vue保險之前 –