老师,axios请求json 报500错误,是因为node少安装什么了吗
<template>
<div>
<home-header></home-header>
<homeswiper></homeswiper>
<home-icons></home-icons>
<home-recommend></home-recommend>
<home-weekend></home-weekend>
</div>
</template>
<script>
import HomeHeader from './components/Header'
import homeswiper from './components/swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Homeweekend'
import axios from 'axios'
export default {
name: 'Home',
components: {
HomeHeader,
homeswiper,
HomeIcons,
HomeRecommend,
HomeWeekend
},
methods: {
getHomeInfo (){
console.log("1")
axios.get('/api/index.json')
.then(this.getHomeInfoSucc)
},
getHomeInfoSucc (res){
console.log('test')
console.log(res)
}
},
mounted (){
this.getHomeInfo()
console.log("2")
}
}
</script>
<style>
</style>
正在回答 回答被采纳积分+1
相似问题
登录后可查看更多问答,登录/注册
- 参与学习 人
- 提交作业 239 份
- 解答问题 10739 个
本阶段带你深入前端开发的肌理,通过ES6基础知识和前端主流高级框架的学习,助你快速构建企业级移动webAPP应用,进入职场的终极battle
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星