vue.js - Is there an issue retriving json data when using vue, axios, and laravel? -
i trying replicate tutorial on vuecasts (https://laracasts.com/series/learn-vue-2-step-by-step/episodes/18).
everything looks fine , don't errors except warning:
resource interpreted document transferred mime type application/json: "http://vueme.app:8000/skills"
i tried change content-type text/html suggested here: resource interpreted document transferred mime type application/json warning in chrome developer tools
web.php:
route::get('/', function () { return view('welcome'); }); route::get('skills', function(){ return ['javascript', 'php', 'python']; });
welcome.blade.php:
<!doctype html> <html lang="{{ app()->getlocale() }}"> <head> <meta charset="utf-8"> <title>laravel</title> </head> <body> <div id="root"> <ul> <li v-for="skill in skills" v-text="skill"></li> </ul> </div> <script scr="https://unpkg.com/axios/dist/axios.min.js"></script> <script scr="https://unpkg.com/vue"></script> <script scr="/js/app.js"></script> </body> </html>
app.js:
new vue({ el: '#root', data:{ skills:[] }, mounted(){ axios.get('/skills').then(response => this.skills = response.data); } });
what's not working?
Comments
Post a Comment