老师现在的接口都访问不了,后面项目的接口也是一样,访问不也,老师看一下,怎么都访问不了
来源:7-13 使用 axios 发送ajax 请求

xiami123
2024-07-24
写回答
1回答
-
xiami123
提问者
2024-07-24
<script>
import { toRefs } from "vue";
import { useStore } from "vuex";
import axios from "axios";
export default {
name: "HomeView",
setup() {
axios
.get(
"https://www.fastmock.site/mock/ae8e9031947a302fed5f92425995aa19/jd/api/user/register"
)
.then((response) => {
console.log(response);
});
const store = useStore();
const { name } = toRefs(store.state);
const handleClick = () => {
store.dispatch("getData");
};
return {
name,
handleClick,
};
},
};
</script>
老师代码是没有错的,是接口访问不了的问题
012024-09-13
相似问题