Where to define axios


#1

so i already do "npm-install " for axios
“dependencies”: {
“axios”: “^0.18.0”,
“vue-axios”: “^2.0.2”

then i put these line in main.js i also tried to put it in router index.js

import axios from ‘axios’;
import VueAxios from ‘vue-axios’;
Vue.use(VueAxios, axios)

but everytime i build the app, i still got the error message " axios is not defined "


#2

Do you use any transpiler like Babel? If not try the require statement instead if ES6 import which doesn’t work well in Android.


#3

thanks for the reply , but it turns out i just need to put : import axios from ‘axios’; in the actual page/component

<script>
import axios from 'axios';

  export default {
    data () {
      return {