我正在尝试使用Vue.js显示来自其余API的信息 在一个组件中,我想显示用户...
<template>
<div>
<h1>User Manager</h1>
<p>
{{ users }}
</p>
</div>
</template>
在脚本部分:
<script>
import {AxiosInstance as axios} from "axios";
export default {
name: "User",
data(){
return{
users: null
}
},
methods: {
getUsers(){
axios.get("http://localhost:4000/api/users").then(response => {
console.log(response);
this.users = response.data;
});
}
},
mounted(){
this.getUsers();
}
}
</script>
<style scoped></style>
很不幸,我收到一条错误消息,例如: 挂接钩中的错误:“ TypeError:无法读取未定义的属性'get'” TypeError:无法读取未定义的属性“ get” ...