首页 > 解决方案 > 将 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); })

标签: laravelvue.jsnativescriptnativescript-vue

解决方案


推荐阅读