这是我的Api服务组件,我使用的是Axios:
import api from './Api.vue';
export default {
name: 'app-feed-service',
methods: {
getPosts() {
return api.get('posts/');
}
}
}
还有一些饲料成分
import AppSinglePost from './../Feed/Post.vue';
import AppFeedService from './../../api/Feed.vue';
export default {
name: 'app-posts',
components: {
AppSinglePost
},
data() {
return {
posts: []
}
},
created() {
AppFeedService.getPosts().then((res) => {
console.log(res);
});
}
}
现在是错误:
TypeError: __WEBPACK_IMPORTED_MODULE_1__api_Feed_vue___default.a.getPosts is not a function
有人能帮忙吗?