0👍
If you are in dev environnement you probably access your vue app by http://localhost:8080.
Your axios should call real url of your local web server :
axios.get(process.env.ROOT_API+'/ajaxfile.php?postid='+this.id)
And add the ROOT_API definition to your dev and prod config (/config/dev.env.js and /config/prod.env.js) :
here is my dev.env.js :
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
ROOT_API: '"http://my-local-domaine.ltd"',
})
Source:stackexchange.com