|
@@ -1,7 +1,8 @@
|
|
import { View, Map } from '@tarojs/components'
|
|
import { View, Map } from '@tarojs/components'
|
|
import style from './index.module.less'
|
|
import style from './index.module.less'
|
|
-
|
|
|
|
|
|
+import avatarDefault from "@/images/avatar-default.png";
|
|
import Taro from '@tarojs/taro';
|
|
import Taro from '@tarojs/taro';
|
|
|
|
+import { useState } from 'react';
|
|
interface Props {
|
|
interface Props {
|
|
children?: React.ReactChild | React.ReactChild[];
|
|
children?: React.ReactChild | React.ReactChild[];
|
|
longitude: number
|
|
longitude: number
|
|
@@ -19,6 +20,20 @@ const Index: React.FC<Props> = ({children, latitude, longitude, name = '', addre
|
|
console.log(e)
|
|
console.log(e)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 标记点配置
|
|
|
|
+ const [markers] = useState([
|
|
|
|
+ {
|
|
|
|
+ id: 1, // 必须唯一
|
|
|
|
+ latitude: latitude, // 纬度
|
|
|
|
+ longitude: longitude, // 经度
|
|
|
|
+ iconPath: avatarDefault, // 本地图标路径
|
|
|
|
+ width: 30, // 图标宽度(像素)
|
|
|
|
+ height: 30, // 图标高度
|
|
|
|
+ title: name, // 点击时显示的标题
|
|
|
|
+ }
|
|
|
|
+ ])
|
|
|
|
+
|
|
|
|
+
|
|
// const handleClick = () => {
|
|
// const handleClick = () => {
|
|
// Taro.openLocation({
|
|
// Taro.openLocation({
|
|
// latitude,
|
|
// latitude,
|
|
@@ -41,6 +56,7 @@ const Index: React.FC<Props> = ({children, latitude, longitude, name = '', addre
|
|
onError={onError}
|
|
onError={onError}
|
|
longitude={longitude}
|
|
longitude={longitude}
|
|
latitude={latitude}
|
|
latitude={latitude}
|
|
|
|
+ markers={markers}
|
|
enableZoom={enableZoom}
|
|
enableZoom={enableZoom}
|
|
enableScroll={enableScroll}
|
|
enableScroll={enableScroll}
|
|
|
|
|