Saturday, March 2, 2019

Fetch/parse API/json using axios in vuejs





    <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Vue js Axios</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
    <div id="app">
        <p>{{tasks.title}}</p>
    </div>

    <script>
    
    var vm = new Vue ({
        el:'#app',
        data: {
            tasks : ''
        },

        mounted(){
            
            axios.get('https://api.myjson.com/bins/17x8qm')
            .then(response => this.tasks = response.data);
            }



    });

    </script>
</body>
</html>




http://blog.vuejoy.com/4-axios/

No comments:

Post a Comment

V-MODEL .NUMBER SOLVE 1+1=11

facing this problem? So do I. Vuejs already solve this problem by adding .number on v-model https://vuejs.org/v2/guide/forms.html#n...