Using vue-resource in VUE single file component
this.$http.get
Error after webpack
The code prompt is in bootstrap.js
Vue.http.interceptors.push((request, next) => {
request.headers.set('X-CSRF-TOKEN', Laravel.csrfToken);
next();
});
This sentence is wrong! The error message Laravel is not defined!
Delete this sentence and run it normally!
Token cannot be obtained in this way. . . You need {{}} to parse the template, otherwise laravel will directly output Laravel.csrfToken into the js code, so that js will mistakenly think that Laravel is an object.
Tips: Remember to add quotation marks.