私のvueコンポーネントにcsrf_field()を追加するにはどうすればいいですか?エラーはVueコンポーネントのCSRFフィールド
プロパティまたはメソッド "csrfToken"がインスタンスで定義されていませんが、レンダリング中に参照されています。データオプションで無効なデータプロパティを宣言してください。
ここでは、コードです:
<script>
export default {
name: 'create',
data: function(){
return {
msg: ''
}
},
props:['test']
}
</script>
<template>
<div id="app">
<form action="#" method="POST">
{{csrfToken()}}
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" class="form-control">
</div>
<div class="form-group">
<label for="location">Location</label>
<input type="text" id="location" class="form-control">
</div>
<div class="form-group">
<label for="age">Age</label>
<input type="number" id="age" class="form-control">
</div>
<div class="form-group">
<input type="submit" class="btn btn-default">
</div>
</form>
</div>
</template>
この質問はクローンのようですhttps://stackoverflow.com/questions/39938284/how-to-pass-laravel-csrf-token-value-to-vue/47715332 –