[Solved] (6) Axios error reporting, cannot read property ‘protocol’ of undefined

After NPM run build package is run in the project built by Vue cli, an error is reported

Cannot read property 'protocol' of undefined

Locate the error in the router file. From the cause of routing, the problem appears in the Axios application mode. Because Vue resource was used before, its usage mode is as follows:

/*Introducing the Resource Request plugin*/
import Resource from 'vue-resource'

/*Using the VueResource plugin*/

However, when I change it to Axios, according to his way, although the local runtime is OK, the above errors will appear after packaging. The correct way should be

After introducing the Axios plug-in, assign it to Vue. Prototype. $HTTP, and use the VM. $http. Get () method directly

Similar Posts: