【发布时间】:2020-06-08 02:42:25
【问题描述】:
我尝试在 localhost 上运行我的 laravel 项目,然后尝试通过 localhost 地址将其连接到其他移动设备和台式机/笔记本电脑上。当我尝试在托管 localhost 的桌面上运行该功能时,它可以正常工作,但在其他设备上却无法正常工作。这是我的 javascript 代码。
我试图查看我的检查,这就是我得到的。
“加载资源失败:net::ERR_CONNECTION_REFUSED”
这是我的脚本不工作:
<script>
const app = new Vue({
el:'main',
data:{
dropdown: [],
selected: null,
trans:{}
},
mounted(){
this.getTrans();
},
methods:{
getTrans(){
axios.get('http://localhost/dqrs/api/transactions')
.then((response)=>{
this.trans=response.data
})
.catch(function (error){
console.log(error);
});
},
setDropdown: function (type) {
this.selected = null;
this.dropdown = this.trans[type];
console.log(type)
}
}
})
【问题讨论】:
-
在您的移动设备上@987654324@ 上不会运行任何服务器,您需要运行服务器的机器的 IP/域。
标签: javascript php html laravel vue.js