laravel - 将 nativescripte vue 应用程序连接到 localhost 服务器
问题描述
我有 Laravel 应用程序作为服务器,我正在尝试将它连接到模拟器(同一台机器)上的本机脚本 vue 应用程序。
当我使用外部 api 时,它工作得很好但是当使用我的 api 时它不会连接:
axios({ method: "GET", "url": "http://127.0.0.1:8000/api/posts" }) .then(result => { this.posts = result.data ; }, error => { console.error(error); });
并且
axios({ method: "GET", "url": "http://10.0.2.2:8000/api/posts" }) .then(result => { this.posts = result.data ; }, error => { console.error(error); })
解决方案
推荐阅读
- c# - How to prevent my Include() statement from populating the included entity's collection?
- python-3.x - 将字典列表分组为基于多个键的字典列表列表
- spring-boot - 使用 Docker Swarm 的 Spring Boot Admin 无法提取健康指标
- xml - 如何设置WADL文件的官方格式?
- angular - 编码模式:对自定义模型的数组进行排序应该在模型中还是在服务中?
- python - Semantic Error using Conditionals statements
- instagram - 如何使用用户名从 instagram API 获取 hd_profile_pic_url_info?
- unit-testing - 无法在kubebuilder的client.Client中获取K8S资源进行单元测试
- react-native - How to pass data from screen to screen from flat list item
- chm - How can I install the license key for my Abee CHM Maker?