<script>
export default {
props:['postId'],
data() {
return {
tasks: [],
id: ''
}
},
created() {
this.id = this.postId,
axios.get('./api/task/' + id) //didn't return result
.then(response => {
this.tasks = response.data
});
},
methods: {
updateId: function (updatedId) {
this.id = updatedId;
}
},
mounted() {
console.log('Component mounted.')
}
}
</script>
API-маршрут
Route::resource('task','Post2Controller');
Я пытаюсь получить определенную строку данных.
Ошибка:
app.js: 38012 [Vue warn]: ошибка в созданном хуке: «ReferenceError: идентификатор не определен»