@heycar/heycars-map 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +1 -1
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
- package/dist/index.cjs +13 -12
- package/dist/index.js +478 -468
- package/package.json +1 -1
- package/src/Demo/DemoBusinessRecomendPlace.tsx +1 -0
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +12 -1
- package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +10 -5
- package/todo.md +3 -5
package/package.json
CHANGED
|
@@ -64,6 +64,7 @@ export const DemoBusinessRecomendPlace = defineSetup(function DemoBusinessRecome
|
|
|
64
64
|
<SomeAutoComplete cityName="Shinjuku-ku"></SomeAutoComplete>
|
|
65
65
|
<BusinessRecomendPlaceMap
|
|
66
66
|
class={css.demo}
|
|
67
|
+
geoErrorTitle={"定位获取失败\n请手动设置上车点"}
|
|
67
68
|
geoLoadingTitle={"正在读取GPS位置信息..."}
|
|
68
69
|
unavailableTitle={"当前区域暂未开通服务"}
|
|
69
70
|
noRecomendDescription={"附近无推荐上车地点"}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { computed } from "vue-demi";
|
|
1
2
|
import imgAddressLocator from "../../assets/icons/svg/address-locator.svg";
|
|
2
3
|
import imgArrowRight from "../../assets/icons/svg/arrow-right.svg";
|
|
3
4
|
import type { MapLogProps } from "../../hooks/useMapLog";
|
|
4
5
|
import { defineSetup } from "../../types/helper";
|
|
5
6
|
import * as css from "./AbsoluteAddressBox.css";
|
|
6
7
|
|
|
8
|
+
interface MultilineTitleProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
const MultilineTitle = defineSetup(function MultilineTitle(props: MultilineTitleProps) {
|
|
12
|
+
const linesRef = computed(() => {
|
|
13
|
+
return props.value?.split("\n").flatMap((line, idx) => (idx === 0 ? line : [<br />, line]));
|
|
14
|
+
});
|
|
15
|
+
return () => <div>{linesRef.value}</div>;
|
|
16
|
+
});
|
|
17
|
+
|
|
7
18
|
export interface AbsoluteAddressBoxProps extends MapLogProps {
|
|
8
19
|
type: "box" | "locator";
|
|
9
20
|
title: string;
|
|
@@ -27,7 +38,7 @@ export const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox(
|
|
|
27
38
|
<div class={css.absoluteAddressBoxLayout}>
|
|
28
39
|
<div class={css.absoluteAddressBox} onClick={handleClick}>
|
|
29
40
|
<div class={css.boxTextLayout}>
|
|
30
|
-
<
|
|
41
|
+
<MultilineTitle class={css.boxTitle} value={title} />
|
|
31
42
|
{description && <div class={css.boxDescription}>{description}</div>}
|
|
32
43
|
</div>
|
|
33
44
|
<img class={css.arrowRight} src={imgArrowRight} />
|
|
@@ -24,6 +24,7 @@ export interface BusinessRecomendPlaceMapProps
|
|
|
24
24
|
Pick<UseMapRecomendPlaceProps<CenterPlaceSource>, "getRecomendPlace">,
|
|
25
25
|
MapLogProps {
|
|
26
26
|
geoLoadingTitle: string;
|
|
27
|
+
geoErrorTitle: string;
|
|
27
28
|
unavailableTitle: string;
|
|
28
29
|
recomendDescription: string;
|
|
29
30
|
noRecomendDescription: string;
|
|
@@ -150,14 +151,17 @@ export const BusinessRecomendPlaceMap = defineLagecySetup(
|
|
|
150
151
|
return () => {
|
|
151
152
|
const title = geoLoading.value
|
|
152
153
|
? props.geoLoadingTitle
|
|
154
|
+
: geoError.value
|
|
155
|
+
? props.geoErrorTitle
|
|
153
156
|
: availableRef.value
|
|
154
157
|
? centerPlace.name
|
|
155
158
|
: props.unavailableTitle;
|
|
156
|
-
const description =
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
const description =
|
|
160
|
+
!availableRef.value || geoError.value || geoLoading.value
|
|
161
|
+
? undefined
|
|
162
|
+
: placeCandidates.value.length > 0
|
|
163
|
+
? props.recomendDescription
|
|
164
|
+
: props.noRecomendDescription;
|
|
161
165
|
return (
|
|
162
166
|
<HeycarMap center={centerPoint.value} zoom={18} mapRef={setMap} log={props.log}>
|
|
163
167
|
<PassengerCircle position={geoPosition.value} />
|
|
@@ -175,6 +179,7 @@ export const BusinessRecomendPlaceMap = defineLagecySetup(
|
|
|
175
179
|
}
|
|
176
180
|
).props([
|
|
177
181
|
"log",
|
|
182
|
+
"geoErrorTitle",
|
|
178
183
|
"geoLoadingTitle",
|
|
179
184
|
"unavailableTitle",
|
|
180
185
|
"recomendDescription",
|
package/todo.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-component-like-airbnb-in-nextjs
|
|
2
2
|
|
|
3
3
|
2. Google 地址名称太长
|
|
4
|
-
3.
|
|
5
|
-
4.
|
|
6
|
-
5. google/高德 坐标系转化
|
|
4
|
+
3. 高德地图加载期间出现大量的请求
|
|
5
|
+
4. google/高德 坐标系转化
|
|
7
6
|
|
|
8
7
|
---
|
|
9
8
|
|
|
@@ -17,5 +16,4 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
17
16
|
|
|
18
17
|
---
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
2. 用户地址搜索,先设置台湾,搜个结果,然后切换城市到新加坡,搜索到结果依然是台湾
|
|
19
|
+
2. google cityparent 要用 city 上级,目前是 country 下级
|