How to use axios in vuex?

index.js

import { post, get } from "./axios.js"

let getList = function index (params) {
  return get("http://localhost/blog/public/index.php/api/home", params)
}

export default {getList}

actions.js

import { getList } from "../api/index.js"
getLists (val) {
    getList.then(res => {
      console.log(res)
    })
}
There is a getList method in the

api file. Now I want to use this getList method in vuex"s action.js. Now prompt "export "getList" was not found in". / api/index.js"

May.06,2022

sent default.


export {getList}


export keyword outputs a variable inside the module, and you can also output a function or class (class). It should be noted that the export command specifies an external interface and must establish an one-to-one correspondence with the variables within the module, for example:

var m = 1;
export m;  // 
export {m};

and export default essentially outputs a variable or method called default, and the system allows you to give it any name.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2be27-2b24a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2be27-2b24a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?