【发布时间】:2017-12-15 23:56:59
【问题描述】:
我想问如何在我的 vue 组件中添加 csrf_field()。错误是
属性或方法“csrfToken”未在实例上定义,但在渲染期间被引用。确保在 data 选项中声明响应式数据属性。
代码如下:
<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>
【问题讨论】:
-
这个问题似乎是stackoverflow.com/questions/39938284/…的克隆