提交 ac3d7bc7 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(uni.openLocation): 修复latitude longitude 未校验必填问题

上级 e74f677a
......@@ -3,6 +3,18 @@ export type API_TYPE_OPEN_LOCATION = typeof uni.openLocation
export const OpenLocationOptions: ApiOptions<API_TYPE_OPEN_LOCATION> = {
formatArgs: {
latitude(value, params) {
if (value !== 0 && !value) {
return 'latitude should not be empty.'
}
params.latitude = value
},
longitude(value, params) {
if (value !== 0 && !value) {
return 'longitude should not be empty.'
}
params.longitude = value
},
scale(value, params) {
value = Math.floor(value!)
params.scale = value >= 5 && value <= 18 ? value : 18
......@@ -11,14 +23,8 @@ export const OpenLocationOptions: ApiOptions<API_TYPE_OPEN_LOCATION> = {
}
export const OpenLocationProtocol: ApiProtocol<API_TYPE_OPEN_LOCATION> = {
latitude: {
type: Number,
required: true,
},
longitude: {
type: Number,
required: true,
},
latitude: Number,
longitude: Number,
scale: Number,
name: String,
address: String,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册