main.jsimport Vue from 'vue'
import App from './App'
const app = new Vue({
el: '#app',
template: '<App/>',
components: { App }
})
App.vue<template>
<div>
<tr v-for="corr in corrs" :key="corr.id">
<th>{{corr.id}}</th>
<td>{{corr.name}}</td>
<td>{{corr.fivest}}</td>
<td>{{corr.comment}}</td>
</tr>
</div>
</template>
<script>
import axios from 'axios'
export default {
data () {
return {
corrs: []
}
},
created () {
this.getAllCorrs()
},
methods: {
getAllCorrs () {
axios.get("http://url.local/api.php?action=read").then(response => {
this.corrs = response.data
}).catch(error => {
console.log('-----error-------')
console.log(error)
})
}
}
}
</script>
index.html<div id="app"></div>
<script src="/js/my.js"></script>