vue 3 的项目中报错:Uncaught InternalError: too much recursion

错误的main.js 文件:

import { createApp } from 'vue'

import App from './App.vue'

import router from './router'

import ElementPlus from 'element-plus'

import 'element-plus/dist/index.css'

import './assets/css/fontawesome.min.css'

import axios from 'axios'

axios.defaults.baseURL = 'https://127.0.0.1.com';

axios.defaults.timeout = 5000;

// app.config.globalProperties.$axios = axios;

const app = createApp(App)

app.use(router)

app.use(ElementPlus)

app.use(axios)

app.mount('#app')

错误原因:app.use(axios)

修改后的代码:

import { createApp } from 'vue'

import App from './App.vue'

import router from './router'

import ElementPlus from 'element-plus'

import 'element-plus/dist/index.css'

import './assets/css/fontawesome.min.css'

import axios from 'axios'

axios.defaults.baseURL = 'https://127.0.0.1.com';

axios.defaults.timeout = 5000;

// app.config.globalProperties.$axios = axios;

const app = createApp(App)

app.use(router)

app.use(ElementPlus)

app.config.globalProperties.$axios = axios;

app.mount('#app')

你可能感兴趣的:(vue.js,javascript,前端)