SoFunction
Updated on 2025-04-07

Vue axios sets the access basic path method

After reading the official documents of axios, the configuration becomes simple:

Make the following configuration:

import axios from 'axios'
 = 'http://10.202.42.24:8080/sf-cloud-web'
 = axios

The last line is to configure axios into the Vue prototype, using it as follows:

('/test/1').then(function (response) {})

You may encounter the following error:

?cf95:57 Uncaught (in promise) TypeError: Cannot

read property 'protocol' of undefined

This is because axios is not a VUE plug-in and cannot be referenced using the (axios) method. It needs to be introduced using the above prototype method.

The above article Vue axios sets up the basic access path is all the content I share with you. I hope you can give you a reference and I hope you can support me more.