Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>jQ_ajax_2_axiosNew to Visual Studio Code? Get it now.
jQ_ajax_2_axios

jQ_ajax_2_axios

1714080902120

|
1,961 installs
| (0) | Free
transform jquery ajax into axios
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JQ-Ajax-2-Axios README

as the name meaning, it can transform your $.ajax({}) block into try catch + axios block;

how to use

before transform, you must select the block which you want to transform

  1. key down F1 and input transform, select the one connect to this plugin;
  2. shortcut ctrl + shift + q in windows while cmd + shift + q in Mac;
  3. (recommend), use editor menus, and find the command.

config

jq_ajax_2_axios.config

  • axios_path: your axios path, cause it is hard to know your axios path.

  • reg_str: an nest array which elements contains an reg rule and replace target, make sure your regexp is correct.

  • replace_all: will replace all match element.

  • remove_fn_wrapper: don't need function wrapper.

  • axios_alias: your axios's name, you can all rename: this.$axios which meaning use your global axios from instance.

  • example: open your user settings.json, and copy it into the json

      "jq_ajax_2_axios.config": {
        "axios_path": "import { axios } from '@/apis/request'",
        "reg_str": [[".*?\\$.parseJSON(.*?);", ""]],
        "replace_all": true,
        "remove_fn_wrapper": true,
        "axios_alias": "this.$axios"
    }

note

  1. note that if you have both fail() and error(),and this two function has params, you need to handly transform some code where use the params cause the fail() and error() function are transform together into the catch block.

example

example

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft