You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/4.migration-guide/1.v0-to-v1.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -383,6 +383,15 @@ Use child `ScriptGoogleMapsMarker` components instead:
383
383
+</ScriptGoogleMaps>
384
384
```
385
385
386
+
#### Top-Level `center` and `zoom` Props Deprecated
387
+
388
+
The top-level `center` and `zoom` props on `<ScriptGoogleMaps>`{lang="html"} are deprecated in favour of passing them via `mapOptions`. Both APIs still work; using the legacy form emits a dev-mode warning. When both are set, `mapOptions` wins.
389
+
390
+
```diff
391
+
-<ScriptGoogleMaps :center="{ lat, lng }" :zoom="12" />
### Google Maps Static Placeholder ([#673](https://github.com/nuxt/scripts/pull/673))
387
396
388
397
v1 extracts the built-in static map placeholder into a standalone [`<ScriptGoogleMapsStaticMap>`{lang="html"}](/scripts/google-maps/api/static-map) component. This removes the following props from `<ScriptGoogleMaps>`{lang="html"}:
Copy file name to clipboardExpand all lines: docs/content/scripts/google-maps/2.api/1.script-google-maps.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,20 @@ By default, it will load on the `mouseenter`, `mouseover`, and `mousedown` event
15
15
16
16
See the [Facade Component API](/docs/guides/facade-components#facade-components-api) for all props, events, and slots.
17
17
18
+
::tip
19
+
**Deprecated:** the top-level `center` and `zoom` props are now deprecated. Pass them via `mapOptions` instead. The legacy props still work and emit a dev-mode warning when used. `mapOptions.center` and `mapOptions.zoom` take precedence when both are set.
20
+
21
+
```vue
22
+
<template>
23
+
<!-- Before (deprecated) -->
24
+
<ScriptGoogleMaps :center="{ lat, lng }" :zoom="12" />
console.warn(`[nuxt-scripts] <ScriptGoogleMaps> prop "${prop}" was removed in v1. ${message} See https://scripts.nuxt.com/docs/migration-guide/v0-to-v1`)
'[nuxt-scripts] <ScriptGoogleMaps> prop "center" is deprecated; use `:map-options="{ center: ... }"` instead. See https://scripts.nuxt.com/docs/migration-guide/v0-to-v1',
60
+
)
61
+
}
62
+
if(props.zoom!==undefined){
63
+
warned++
64
+
console.warn(
65
+
'[nuxt-scripts] <ScriptGoogleMaps> prop "zoom" is deprecated; use `:map-options="{ zoom: ... }"` instead. See https://scripts.nuxt.com/docs/migration-guide/v0-to-v1',
66
+
)
67
+
}
68
+
returnwarned
69
+
}
70
+
44
71
/**
45
72
* Wait until the Google Maps API and a Map instance are both available.
0 commit comments