openLocation.ts 578 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2
export const API_OPEN_LOCATION = 'openLocation'
export type API_TYPE_OPEN_LOCATION = typeof uni.openLocation
fxy060608's avatar
fxy060608 已提交
3

fxy060608's avatar
fxy060608 已提交
4
export const OpenLocationOptions: ApiOptions<API_TYPE_OPEN_LOCATION> = {
fxy060608's avatar
fxy060608 已提交
5
  formatArgs: {
fxy060608's avatar
fxy060608 已提交
6 7
    scale(value, params) {
      value = Math.floor(value!)
fxy060608's avatar
fxy060608 已提交
8
      params.scale = value >= 5 && value <= 18 ? value : 18
9 10
    },
  },
fxy060608's avatar
fxy060608 已提交
11 12
}

fxy060608's avatar
fxy060608 已提交
13
export const OpenLocationProtocol: ApiProtocol<API_TYPE_OPEN_LOCATION> = {
fxy060608's avatar
fxy060608 已提交
14 15
  latitude: {
    type: Number,
16
    required: true,
fxy060608's avatar
fxy060608 已提交
17 18 19
  },
  longitude: {
    type: Number,
20
    required: true,
fxy060608's avatar
fxy060608 已提交
21
  },
fxy060608's avatar
fxy060608 已提交
22 23 24
  scale: Number,
  name: String,
  address: String,
fxy060608's avatar
fxy060608 已提交
25
}