Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
807c35cb
提交
807c35cb
authored
7月 20, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复:key次数超出
上级
6b9c7d46
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
3 行删除
+6
-3
index.html
index.html
+1
-1
map.tsx
src/components/select-map/map.tsx
+5
-2
没有找到文件。
index.html
浏览文件 @
807c35cb
...
...
@@ -11,7 +11,7 @@
<script
type=
"module"
src=
"/src/main.tsx"
></script>
<script
type=
"text/javascript"
>
window
.
_AMapSecurityConfig
=
{
securityJsCode
:
'
ddafdbc1df318712fc0dc433ed58e56e
'
,
securityJsCode
:
'
a5ef394db56bcb1c188a8abd11b2ac0c
'
,
}
</script>
</body>
...
...
src/components/select-map/map.tsx
浏览文件 @
807c35cb
...
...
@@ -2,6 +2,7 @@
// @ts-nocheck
import
AMapLoader
from
'@amap/amap-jsapi-loader'
;
import
{
Component
}
from
'react'
;
import
{
message
}
from
'antd'
;
interface
MapComponentProps
{
onSelectAddress
:
(
e
:
{
...
...
@@ -45,7 +46,7 @@ class MapComponent extends Component<MapComponentProps> {
// dom渲染成功后进行map对象的创建
componentDidMount
()
{
AMapLoader
.
load
({
key
:
'd
18c59f41e4f4289425f9da523aefeb8
'
,
// 申请好的Web端开发者Key,首次调用 load 时必填
key
:
'd
06295f39703d4e8e795cd979c3bd3a1
'
,
// 申请好的Web端开发者Key,首次调用 load 时必填
version
:
'2.0'
,
// 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins
:
[],
// 需要使用的的插件列表,如比例尺'AMap.Scale'等
})
...
...
@@ -114,7 +115,9 @@ class MapComponent extends Component<MapComponentProps> {
onSearch
(
keyword
:
string
)
{
// 根据关键字进行搜索
this
.
autoComplete
.
search
(
keyword
,
(
status
,
result
)
=>
{
console
.
log
(
'搜索结果-->'
,
result
);
if
(
result
===
'USER_DAILY_QUERY_OVER_LIMIT'
)
{
return
message
.
warning
(
'今日搜索次数已达上限'
);
}
// 搜索成功时,result即是对应的匹配数据
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
this
.
props
.
onSearchAddress
(
result
.
tips
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论