when new to VueJs
https://github.com/coreui/coreui-free-vue-admin-template/blob/master/src/views/base/Tables.vue
in above vue. to assign the data to someData variable dynamically. I tried to bind it like below but it doesnt work.
var someData = () => JSON.parse(“[{Id:2,RollNo:1000,email:test1@test.com,status:Inactive},{Id:3,RollNo:1001,email:test2@test.com,status:Active}]“);
any suggestions please? how to bind it dynamically or through webapi using axios?
Solution :
After a day of struggle and searching all over the places; finally found the solution.
define an empty array and change from const to var to bind the data dynamically at later stage
var someData = () => [{}]
.
.
.
and inside export default { } call api in mounted method
mounted() {
axios({ method: “GET”, “url”: “https://localhost:80/api/values" }).then(result => {
this.items = () => JSON.parse(result.data);
}, error => {
console.error(error);
this.error= error;
});
}