在main.js文件中配置:
//Vue.prototype.$url="http://192.168.1.164/api" //线下接口
Vue.prototype.$url="http://m.demo.com/api" //线上接口
在demo.vue页面中请求:
getInfo(){
uni.request({
method: 'GET',
url: this.$url+"/api-demo/getDemoById?lid=76",
success: (res)=>{},
fail: (err)=>{}
})
}
在uniapp中请求接口
猜你喜欢
转载自www.cnblogs.com/huihuihero/p/12660962.html
今日推荐
周排行