我在main中
import { createApp } from 'vue'
import App from './App.vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
import installElementPlus from './plugins/element.js'
const app = createApp(App)
installElementPlus(app)
app.mount('#app')
app.use(VueAxios, axios)
这么生命的,在index.vue中这么使用
created(){
this.getData()
},
methods: {
getData(){
this.axios.request({url:'http://www.liulongbin.top:3005/api/getlunbo',method:'get'})
.then(res=>{
console.log(res.data);
//this.ArtList = res.data.data;
})
}
},
出现错误:
呢??
修改成:
created(){
this.getData()
},
methods: {
getData(){
this.axios.get('http://www.liulongbin.top:3005/api/getlunbo')
.then(res=>{
console.log(res.data);
//this.ArtList = res.data.data;
})
}
},
结果报错:
这是什么鬼,求教!!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…