Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
1dc2a58e
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1dc2a58e
编写于
8月 02, 2022
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update(h5 map): 增加高德地图全局变量
上级
2b6b8f59
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
11 deletion
+56
-11
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+3
-0
packages/uni-h5-vite/src/plugins/manifestJson.ts
packages/uni-h5-vite/src/plugins/manifestJson.ts
+16
-0
packages/uni-h5-vite/src/plugins/pagesJson.ts
packages/uni-h5-vite/src/plugins/pagesJson.ts
+5
-2
packages/uni-h5/src/helpers/location.ts
packages/uni-h5/src/helpers/location.ts
+32
-9
未找到文件。
packages/shims-uni-app.d.ts
浏览文件 @
1dc2a58e
...
...
@@ -66,6 +66,9 @@ declare namespace UniNamespace {
subPackages
?:
{
root
:
string
}[]
qqMapKey
?:
string
googleMapKey
?:
string
AMapKey
?:
string
AMapServiceHost
?:
string
AMapSecurityJsCode
?:
string
// app-plus
referrerInfo
?:
{
appId
:
string
...
...
packages/uni-h5-vite/src/plugins/manifestJson.ts
浏览文件 @
1dc2a58e
...
...
@@ -59,6 +59,19 @@ export function uniManifestJsonPlugin(): Plugin {
sdkConfigs
.
maps
.
google
&&
sdkConfigs
.
maps
.
google
.
key
const
AMapKey
=
sdkConfigs
.
maps
&&
sdkConfigs
.
maps
.
AMap
&&
sdkConfigs
.
maps
.
AMap
.
key
const
AMapSecurityJsCode
=
sdkConfigs
.
maps
&&
sdkConfigs
.
maps
.
AMap
&&
sdkConfigs
.
maps
.
AMap
.
securityJsCode
const
AMapServiceHost
=
sdkConfigs
.
maps
&&
sdkConfigs
.
maps
.
AMap
&&
sdkConfigs
.
maps
.
AMap
.
serviceHost
let
locale
:
string
|
null
|
undefined
=
manifest
.
locale
locale
=
locale
&&
locale
.
toUpperCase
()
!==
'
AUTO
'
?
locale
:
''
...
...
@@ -92,6 +105,9 @@ export function uniManifestJsonPlugin(): Plugin {
export const async =
${
JSON
.
stringify
(
async
)}
export const qqMapKey =
${
JSON
.
stringify
(
qqMapKey
)}
export const googleMapKey =
${
JSON
.
stringify
(
googleMapKey
)}
export const AMapKey =
${
JSON
.
stringify
(
AMapKey
)}
export const AMapSecurityJsCode =
${
JSON
.
stringify
(
AMapSecurityJsCode
)}
export const AMapServiceHost =
${
JSON
.
stringify
(
AMapServiceHost
)}
export const sdkConfigs =
${
JSON
.
stringify
(
sdkConfigs
)}
export const locale = '
${
locale
}
'
export const fallbackLocale = '
${
fallbackLocale
}
'
...
...
packages/uni-h5-vite/src/plugins/pagesJson.ts
浏览文件 @
1dc2a58e
...
...
@@ -53,7 +53,7 @@ function generatePagesJsonCode(
return
`
import { defineAsyncComponent, resolveComponent, createVNode, withCtx, openBlock, createBlock } from 'vue'
import { PageComponent, AsyncLoadingComponent, AsyncErrorComponent, useI18n, setupWindow, setupPage } from '@dcloudio/uni-h5'
import { appId, appName, appVersion, appVersionCode, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey, nvue, locale, fallbackLocale } from './
${
MANIFEST_JSON_JS
}
'
import { appId, appName, appVersion, appVersionCode, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey,
AMapKey, AMapSecurityJsCode, AMapServiceHost,
nvue, locale, fallbackLocale } from './
${
MANIFEST_JSON_JS
}
'
const locales = import.meta.globEager('./locale/*.json')
${
importLayoutComponentsCode
}
const extend = Object.assign
...
...
@@ -255,13 +255,16 @@ function generateConfig(
appId,
appName,
appVersion,
appVersionCode,
appVersionCode,
async,
debug,
networkTimeout,
sdkConfigs,
qqMapKey,
googleMapKey,
AMapKey,
AMapSecurityJsCode,
AMapServiceHost,
nvue,
locale,
fallbackLocale,
...
...
packages/uni-h5/src/helpers/location.ts
浏览文件 @
1dc2a58e
...
...
@@ -14,21 +14,44 @@ export const ICON_PATH_TARGET =
export
enum
MapType
{
QQ
=
'
qq
'
,
GOOGLE
=
'
google
'
,
AMAP
=
'
AMap
'
,
UNKNOWN
=
''
,
}
export
function
getMapInfo
()
{
let
type
:
MapType
=
MapType
.
UNKNOWN
let
key
:
string
=
''
if
(
__uniConfig
.
qqMapKey
)
{
type
=
MapType
.
QQ
key
=
__uniConfig
.
qqMapKey
}
else
if
(
__uniConfig
.
googleMapKey
)
{
type
=
MapType
.
GOOGLE
key
=
__uniConfig
.
googleMapKey
return
{
type
:
MapType
.
QQ
,
key
:
__uniConfig
.
qqMapKey
,
}
}
if
(
__uniConfig
.
googleMapKey
)
{
return
{
type
:
MapType
.
GOOGLE
,
key
:
__uniConfig
.
googleMapKey
,
}
}
if
(
__uniConfig
.
AMapKey
)
{
return
{
type
:
MapType
.
AMAP
,
key
:
__uniConfig
.
AMapKey
,
securityJsCode
:
__uniConfig
.
AMapSecurityJsCode
,
serviceHost
:
__uniConfig
.
AMapServiceHost
,
}
}
return
{
type
,
key
,
type
:
MapType
.
UNKNOWN
,
key
:
''
,
}
}
let
IS_AMAP
=
false
let
hasGetIsAMap
=
false
export
const
getIsAMap
=
()
=>
{
if
(
hasGetIsAMap
)
{
return
IS_AMAP
}
else
{
hasGetIsAMap
=
true
return
(
IS_AMAP
=
getMapInfo
().
type
===
MapType
.
AMAP
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录