H5跨域

  1. 在uview/request.js中配置
let baseUrl = ""; 
if (process.env.NODE_ENV === 'development') {
	// 开发环境
	baseUrl = "http://dev.com/api"; 
	// #ifdef H5
	baseUrl = '/api';    //H5下将地址修改为/api,/api指向proxy下的/api
	// #endif
} else if (process.env.NODE_ENV === 'production') {
	// 生产环境 
	baseUrl = "http://saas.com/api"; 
	// #ifdef H5
	baseUrl = '/api';   
	// #endif
}
  1. 在vue.config.js中配置
module.exports = {
	// 配置路径别名
	configureWebpack: { 
		devServer:{
			port:'80',
			disableHostCheck:true,
			proxy:{
				'/api':{
					target:'http://dev.com/',
					changeOrigin:true  
				},
				'/api':{
					target:'http://saas.com/',
					changeOrigin:true  
				}
			}
		} 
	}
}

打包

在线制作.9.png图片网址Simple nine-patch generator
iOS开发证书申请
导出p12证书
快速获取 iOS 设备的 UDID

补充:新增UDID要重新配置描述文件

使用蒲公英发布应用扫码下载

其他

H5调用腾讯地图地址转坐标跨域问题,要在腾讯地图密钥配置白名单里添加域名,并使用jsonp

npm i vue-jsonp --save
import Vue from 'vue'
import jsonp from 'vue-jsonp'
Vue.use(jsonp)
this.$jsonp("https://apis.map.qq.com/ws/geocoder/v1", {
					key: '',//申请的密钥
					output: 'jsonp',
					address: this.address,
				}).then(resp => {
					let res = resp.result;
					let latitude = res.location.lat;
					let longitude = res.location.lng;
					uni.openLocation({ //​使用微信内置地图查看位置。
						latitude: latitude, //要去的纬度-地址
						longitude: longitude, //要去的经度-地址
						address: res.title,
						name: res.title
					})
				})
Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐