老师为什么data is undefined 已经贴了代码了

来源:7-13 使用 axios 发送ajax 请求

Dell铁粉

2021-03-31

setup(){
axios.get(“https://www.fastmock.site/mock/ae8e9031947a302fed5f92425995aa19/jd/api/user/register”)
.then((res)=>{
const data = res.data.desc
console.log( data )
});
const store = useStore();
const {name} = toRefs(store.state) //结构
const handleClick = ()=>{
// this.store.dispatch(‘getAxiosData’,)
console.log(this.$options.data)
// store.dispatch(‘getAxiosData’,data)
}
return{
name,
handleClick
}
},

写回答

1回答

Dell

2021-04-01

你打印res 看看是什么

1
3
Dell铁粉
回复
Dell
现在太晚啦,明天我贴一下,感谢Dell~ 你每次必回,很感动,不过也要早点休息
2021-04-01
共3条回复

Vue3入门与项目实战 掌握完整知识体系

明星讲师DELL亲授,全方位知识点+高匹配度项目,入门到深度掌握

3382 学习 · 1454 问题

查看课程