Uncaught TypeError: Cannot redefine property: $url

When using VueResource in today's project, there was an error Uncaught TypeError: Cannot redefine property: $url, which caused some pages to be refreshed before the page could be displayed. After looking at the console, the error message was Uncaught TypeError: Cannot redefine property: $url

Before code:

import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource)

Writing this way will lead to Uncaught TypeError: Cannot redefine property: $url error, modify it to

import Vue from 'vue'
Vue.use(require('vue-resource'))

Problem solved.

Guess you like

Origin blog.csdn.net/qq_30596783/article/details/118210089