[Vuejs]-How do I import backend data from PHP(My SQL) into vuejs application

1👍

Vue.js is a front-end javascript framework so it only renders HTML, CSS, and Javascript in browsers. You really can’t import data like in the backend we do.

So that means you need to consume an API/Service and fetch the data and display it.

You can use Vue Axios, Vue-Resource to make HTTP/Ajax requests and get the result.

Example:

    <ul>
       <li v-for="user in users">{{ user.first_name }}</li>
    </ul>

    getUsers(){
        this.axios.get("https://reqres.in/api/users").then((response) => {
            this.users = response.data.data;
        });
    }

0👍

you need to make restapi to call on the frontend side(vuejs) using axios library.
you can see a basic example of PHP, MySQL and vuejs web app.
https://morioh.com/p/7a2ac36f37cc
or if you want it with laravel then you can check this link
https://vuejsdevelopers.com/2018/02/05/vue-laravel-crud/

👤salman

Leave a comment