├── .browserslistrc
├── .editorconfig
├── .eslintrc.js
├── .eslintrc.json
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── dependabot.yml
└── workflows
│ ├── codeql-analysis.yml
│ └── npm-publish.yml
├── .gitignore
├── .npmignore
├── .prettierrc.js
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── babel.config.js
├── build-copy.js
├── docs
├── .npmignore
├── package-lock.json
├── package.json
└── src
│ ├── .vuepress
│ ├── components
│ │ ├── Foo
│ │ │ └── Bar.vue
│ │ ├── OtherComponent.vue
│ │ └── demo-component.vue
│ ├── config.js
│ ├── enhanceApp.js
│ ├── public
│ │ └── assets
│ │ │ └── logo.jpg
│ └── styles
│ │ ├── index.styl
│ │ └── palette.styl
│ ├── components
│ ├── README.md
│ ├── autocomplete.md
│ ├── circle.md
│ ├── cluster.md
│ ├── info-window.md
│ ├── map.md
│ ├── marker.md
│ ├── polygon.md
│ ├── polyline.md
│ ├── rectangle.md
│ └── using-vue.md
│ ├── config
│ └── README.md
│ ├── docs
│ └── README.md
│ ├── examples
│ ├── README.md
│ ├── how-to-access-google-maps-object.md
│ ├── how-to-add-a-custom-button-to-map.md
│ ├── how-to-add-custom-controls.md
│ ├── how-to-open-or-close-info-window-on-event.md
│ ├── introduction.md
│ ├── points-in-polygon.md
│ └── using-custom-renderer-function-and-clustering-algorithm.md
│ └── index.md
├── jsconfig.json
├── package-lock.json
├── package.json
├── service
├── commands
│ └── build.js
├── config
│ ├── base.js
│ ├── css.js
│ ├── dev.js
│ ├── prod.js
│ └── terserOptions.js
├── project.config.js
└── utils
│ ├── getLocalIP.js
│ ├── logger.js
│ ├── paths.js
│ ├── resolveClientEnv.js
│ └── spinner.js
├── src
├── components
│ ├── autocomplete.vue
│ ├── autocompleteImpl.js
│ ├── build-component.js
│ ├── circle.js
│ ├── cluster.vue
│ ├── heatmap.js
│ ├── infoWindow.vue
│ ├── map.vue
│ ├── mapElementMixin.js
│ ├── marker.vue
│ ├── polygon.js
│ ├── polyline.js
│ └── rectangle.js
├── load-google-maps.js
├── main.js
└── utils
│ ├── TwoWayBindingWrapper.js
│ ├── WatchPrimitiveProperties.js
│ ├── bindEvents.js
│ ├── bindProps.js
│ ├── create-map-script.js
│ ├── env.js
│ ├── lazyValue.js
│ ├── load-google-maps.js
│ ├── mountableMixin.js
│ ├── simulateArrowDown.js
│ └── string.js
├── test
├── .eslintrc.json
├── basic.js
├── gmapApi-guard.js
├── maps-not-loaded.js
├── marker-with-infowindow.js
├── test-all-examples.js
├── test-pages
│ ├── test-gmapApi.html
│ ├── test-marker-with-infowindow.html
│ ├── test-page-without-maps.html
│ └── test-plain-map.html
└── test-setup
│ ├── babel-transform.js
│ ├── compile-standalone.js
│ └── test-common.js
└── types
└── index.d.ts
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset=utf-8
5 | end_of_line=lf
6 | insert_final_newline=true
7 | indent_style=space
8 | indent_size=2
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es6: true,
5 | node: true,
6 | },
7 | "globals": {
8 | "google": true
9 | },
10 | parser: 'vue-eslint-parser',
11 | parserOptions: {
12 | ecmaVersion: 2020,
13 | extraFileExtensions: ['.vue'],
14 | ecmaFeatures: {
15 | jsx: true,
16 | },
17 | sourceType: 'module',
18 | },
19 |
20 | extends: [
21 | 'plugin:vue/vue3-essential',
22 | 'eslint:recommended',
23 | 'plugin:prettier/recommended',
24 | 'prettier',
25 | ],
26 |
27 | rules: {
28 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
29 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
30 | 'vue/multi-word-component-names': ['off'],
31 | },
32 | }
33 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true,
6 | "node": true
7 | },
8 | "extends": "standard",
9 | "parserOptions": {
10 | "sourceType": "module"
11 | },
12 | "rules": {
13 | "comma-dangle": 0
14 | },
15 | "globals": {
16 | "google": true
17 | },
18 | "plugins": [
19 | "html"
20 | ],
21 | "settings": {
22 | "html/html-extensions": [".html", ".vue"]
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Report a new bug
3 | about: Create a bug report to help our library improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 | ---
8 |
9 | **Read before opening a new issue (I suggest you read in preview mode)**
10 | **Are you asking a question or need help?**
11 | Please use Github discussion, you will find better help there.
12 | Notice that if you create a question issue, we will close it and create a new discussion for you.
13 |
14 | **Having problems with an event?**
15 | You should trying enabling events before using them.
16 | More details here: https://vue-map.netlify.app/docs/#register-google-maps-events.
17 |
18 | **Playcode support**
19 | We strongly recommend you to use Playcode to reproduce your code!
20 | You can find a small template [here](https://playcode.io/1012771).
21 | Following the steps on the template will make things really, really easier!
22 |
23 | **Codepen support**
24 | You can use Codepen to report your bug as well!
25 | In your Codepen, go to Settings, then select JS. In Add Packages section, search for vue-google-maps-community-fork.
26 | TBH Codepen isn't a really good option because of the file structure, but feel free to use if you prefer it!
27 |
28 | **Lastly, remember to look if this issue isn't already created**
29 |
30 | **OK! You can delete everything until here!**
31 | **You can also delete whatever part you want in this issue, but please make it clear**
32 |
33 | **Describe what you're reporting**
34 | Don't be ashamed to show what you're doing. Give us a clear and concise description of what the bug is.
35 |
36 | **How can we reproduce it?**
37 | Show us how to reproduce the bug.
38 |
39 | Example:
40 |
41 | 1. Go to '...'
42 | 2. Click on '....'
43 | 3. Scroll down to '....'
44 | 4. See error
45 |
46 | **What were your expecting to happen?**
47 | A description of the expected behavior.
48 |
49 | **What happened?**
50 | A description of the actual behavior.
51 |
52 | **Screenshots**
53 | You can send screenshots to help express what you want to show us.
54 |
55 | **Device or enviroment**
56 |
57 | - In which OS are you seeing this bug? Examples: Windows 11, Ubuntu, iOS.
58 | - If it is relevant, what browser are you? Examples: Chrome, Safari, Opera.
59 | - What is your npm version? You can check using npm -v.
60 | - What is your vue version? You can check using npm list.
61 | - What is your vue-google-maps-community-fork version? You can check using npm list.
62 |
63 | **Additional context**
64 | You also can add more context for your situation here. Feel free to express whatever you think its important.
65 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest a new feature to make our library better
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 | ---
8 |
9 | **Read before opening a new issue**
10 | **Are you asking a question or need help?**
11 | Please use Github discussion, you will find better help there.
12 | Notice that if you create a question issue, we will close it and create a new discussion for you.
13 |
14 | **Playcode support**
15 | We strongly recommend you to use Playcode to reproduce your code!
16 | You can find a small template [here](https://playcode.io/1012771).
17 | Following the steps on the template will make things really, really easier!
18 |
19 | **Codepen support**
20 | You can use Codepen to report your bug as well!
21 | In your Codepen, go to Settings, then select JS. In Add Packages section, search for vue-google-maps-community-fork.
22 | TBH Codepen isn't a really good option because of the file structure, but feel free to use if you prefer it!
23 |
24 | **Lastly, remember to look if this issue isn't already created**
25 |
26 | **OK! You can delete everything until here!**
27 | **You can also delete whatever part you want in this issue, but please make it clear**
28 |
29 | **Does your feature has anything related to a problem?**
30 | Please describe what the problem is related to. For example: I'm frustrated that I cannot do [...] easily.
31 |
32 | **What is the best solution you'd like to see?**
33 | Describe what you think should be happening to fix that situation.
34 |
35 | **What did you try? Did you have some alternative to consider?**
36 | Is there any other solution or feature it could help fixing this situation?
37 |
38 | **Additional context**
39 | You also can add more context for your situation here. Feel free to express whatever you think its important.
40 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 |
2 | # To get started with Dependabot version updates, you'll need to specify which
3 | # package ecosystems to update and where the package manifests are located.
4 | # Please see the documentation for all configuration options:
5 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
6 |
7 | version: 2
8 | updates:
9 | - package-ecosystem: "npm" # See documentation for possible values
10 | directory: "/" # Location of package manifests
11 | schedule:
12 | interval: "daily"
13 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '40 20 * * 3'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 |
28 | strategy:
29 | fail-fast: false
30 | matrix:
31 | language: [ 'javascript' ]
32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33 | # Learn more:
34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35 |
36 | steps:
37 | - name: Checkout repository
38 | uses: actions/checkout@v2
39 |
40 | # Initializes the CodeQL tools for scanning.
41 | - name: Initialize CodeQL
42 | uses: github/codeql-action/init@v1
43 | with:
44 | languages: ${{ matrix.language }}
45 | # If you wish to specify custom queries, you can do so here or in a config file.
46 | # By default, queries listed here will override any specified in a config file.
47 | # Prefix the list here with "+" to use these queries and those in the config file.
48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
49 |
50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51 | # If this step fails, then you should remove it and run the build manually (see below)
52 | - name: Autobuild
53 | uses: github/codeql-action/autobuild@v1
54 |
55 | # ℹ️ Command-line programs to run using the OS shell.
56 | # 📚 https://git.io/JvXDl
57 |
58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59 | # and modify them (or add more) to build your code if your project
60 | # uses a compiled language
61 |
62 | #- run: |
63 | # make bootstrap
64 | # make release
65 |
66 | - name: Perform CodeQL Analysis
67 | uses: github/codeql-action/analyze@v1
68 |
--------------------------------------------------------------------------------
/.github/workflows/npm-publish.yml:
--------------------------------------------------------------------------------
1 | name: npm-publish
2 | on:
3 | push:
4 | branches:
5 | - main
6 | jobs:
7 | npm-publish:
8 | name: npm-publish
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Checkout repository
12 | uses: actions/checkout@master
13 | - name: Set up Node.js
14 | uses: actions/setup-node@master
15 | with:
16 | node-version: 10.0.0
17 | - name: Publish if version has been updated
18 | uses: houtianze/npm-publish-action@master
19 | with:
20 | tag_name: "v%s"
21 | tag_message: "v%s"
22 | commit_pattern: "^(?:Release|Version) (\\S+)"
23 | env:
24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 | NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 |
23 | # Git
24 | *.diff
25 | *.patch
26 | *.bak
27 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .github
2 | service
3 | test
4 | .browserlist
5 | .editorconfig
6 | .eslintrc
7 | .gitignore
8 | .prettierrc.js
9 | babel.config.js
10 | build-copy.js
11 | CONTRIBUTING.md
12 | jsconfig.json
13 | docs
14 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | printWidth: 100,
3 | semi: false,
4 | singleQuote: true,
5 | }
6 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | When contributing to this repository, please first discuss the change you wish to make via issue,
4 | email, or any other method with the owners of this repository before making a change.
5 |
6 | Please note we have a code of conduct, please follow it in all your interactions with the project.
7 |
8 | ## Pull Request Process
9 |
10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11 | build.
12 | 2. Update the README.md or docs with details of changes if necessary.
13 | 3. Increase the version numbers in any examples files and the README.md to the new version that this
14 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
15 |
16 | ## Code of Conduct
17 |
18 | ### Our Pledge
19 |
20 | In the interest of fostering an open and welcoming environment, we as
21 | contributors and maintainers pledge to making participation in our project and
22 | our community a harassment-free experience for everyone, regardless of age, body
23 | size, disability, ethnicity, gender identity and expression, level of experience,
24 | nationality, personal appearance, race, religion, or sexual identity and
25 | orientation.
26 |
27 | ### Our Standards
28 |
29 | Examples of behavior that contributes to creating a positive environment
30 | include:
31 |
32 | * Using welcoming and inclusive language
33 | * Being respectful of differing viewpoints and experiences
34 | * Gracefully accepting constructive criticism
35 | * Focusing on what is best for the community
36 | * Showing empathy towards other community members
37 |
38 | Examples of unacceptable behavior by participants include:
39 |
40 | * The use of sexualized language or imagery and unwelcome sexual attention or
41 | advances
42 | * Trolling, insulting/derogatory comments, and personal or political attacks
43 | * Public or private harassment
44 | * Publishing others' private information, such as a physical or electronic
45 | address, without explicit permission
46 | * Other conduct which could reasonably be considered inappropriate in a
47 | professional setting
48 |
49 | ### Our Responsibilities
50 |
51 | Project maintainers are responsible for clarifying the standards of acceptable
52 | behavior and are expected to take appropriate and fair corrective action in
53 | response to any instances of unacceptable behavior.
54 |
55 | Project maintainers have the right and responsibility to remove, edit, or
56 | reject comments, commits, code, wiki edits, issues, and other contributions
57 | that are not aligned to this Code of Conduct, or to ban temporarily or
58 | permanently any contributor for other behaviors that they deem inappropriate,
59 | threatening, offensive, or harmful.
60 |
61 | ### Scope
62 |
63 | This Code of Conduct applies both within project spaces and in public spaces
64 | when an individual is representing the project or its community. Examples of
65 | representing a project or community include using an official project e-mail
66 | address, posting via an official social media account, or acting as an appointed
67 | representative at an online or offline event. Representation of a project may be
68 | further defined and clarified by project maintainers.
69 |
70 | ### Enforcement
71 |
72 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
73 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
74 | complaints will be reviewed and investigated and will result in a response that
75 | is deemed necessary and appropriate to the circumstances. The project team is
76 | obligated to maintain confidentiality with regard to the reporter of an incident.
77 | Further details of specific enforcement policies may be posted separately.
78 |
79 | Project maintainers who do not follow or enforce the Code of Conduct in good
80 | faith may face temporary or permanent repercussions as determined by other
81 | members of the project's leadership.
82 |
83 | ### Attribution
84 |
85 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
86 | available at [http://contributor-covenant.org/version/1/4][version]
87 |
88 | [homepage]: http://contributor-covenant.org
89 | [version]: http://contributor-covenant.org/version/1/4/
90 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Jamie Yang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Note for the community
2 |
3 | Hey guys, today is 18/12/2024 and I'm doing this update to address you on the current situation of this library.
4 |
5 | To be honest I cannot help it improve anymore because my life changed too much in the last year. That said, you probably should be using [vue3-google-map](https://www.npmjs.com/package/vue3-google-map) for now on because their job is incredible and they're doing a great project for Google Maps features. Sorry to let you guys down but I prefer to be honest than say something that I won't be able to handle.
6 |
7 | I'm not turning it into deprecated yet, but probably will do soon. This project is awesome and it worked like a charm for me but I believe it would need an entire refactor to TS to make it better and scalable. Fawmi's code was so good that even after two and half years of no updates it still had 2.5k weekly downloads.
8 |
9 | Anyway, thanks for everything and sorry again. Much love and luck.
10 |
11 | ## Welcome!
12 |
13 | Hi! Vue Google Maps Community Fork is a communitary repository. It is a set of the most used Google Maps components made for VueJS 3.
14 |
15 | ## About this repository
16 |
17 | This repository was forked in October/2022 after the original repository's community decide that it was the best for the project. In [the same discussion](https://github.com/NathanAP/vue-google-maps-community-fork/discussions/1) you will find every information you need about our motivation.
18 |
19 | We have an update! Fawmi answered us, please access the discussion to know more about it!
20 |
21 | ## Changelog
22 |
23 | You can follow the official changelog [here](https://github.com/NathanAP/vue-google-maps-community-fork/discussions/6)!
24 |
25 | ## Documentation
26 |
27 | You can find a detailed documentation [here](https://vue-google-maps-community-fork.netlify.app). It will show you how to use every component this library contains and demonstrate some examples for you.
28 |
29 | Also, you can enter in [this discussion](https://github.com/NathanAP/vue-google-maps-community-fork/discussions/9) to talk about or read the documentation changelog.
30 |
31 | It is in our plans to make it better and more detailed, but for now it might help you start using the library.
32 |
33 | ## Installation
34 |
35 | You can install this library using this command:
36 |
37 | ```
38 | npm install vue-google-maps-community-fork
39 | ```
40 |
41 | ## Basic usage
42 |
43 | To use this library you will need an API Key. You can learn how to get an API Key [here](https://developers.google.com/maps/documentation/javascript/get-api-key).
44 |
45 | ### Configure Vue to use the Components
46 |
47 | In your `main.js`
48 |
49 | ```js
50 | import { createApp } from 'vue'
51 | import VueGoogleMaps from 'vue-google-maps-community-fork'
52 |
53 | const app = createApp(App)
54 | app
55 | .use(VueGoogleMaps, {
56 | load: {
57 | key: 'YOUR_API_KEY_COMES_HERE',
58 | },
59 | })
60 | .mount('#app')
61 | ```
62 |
63 | ### If you are configuring your project please notice
64 |
65 | You might be getting the following error:
66 |
67 | `Requested module 'fast-deep-equal' does not provide an export named 'default'`
68 |
69 | Some notes about this:
70 |
71 | - [We are aware of this problem](https://github.com/NathanAP/vue-google-maps-community-fork/issues/4).
72 | - It doesn't seems that we have control over this, so we hope that it will be fixed soon enough by the responsibles.
73 | - To avoid it right now, you need to do this configuration in your `vite.config.js`:
74 |
75 | ```js
76 | optimizeDeps: {
77 | include: [
78 | "vue-google-maps-community-fork",
79 | "fast-deep-equal",
80 | ],
81 | },
82 | ```
83 |
84 | - This **IS NOT** a fix! This is just a hack we are using to avoid the problem.
85 | - We encourage you to subscribe to that issue to stay in touch with this problem
86 |
87 | ### Using our components anywhere
88 |
89 | ```vue
90 |
91 |
92 |
93 |
94 |
95 |
105 | ```
106 |
107 | ## Components
108 |
109 | ### Markers
110 |
111 | If you need to add markers to the `Map`, add `GMapMarker` as child of `GMapMap` component.
112 |
113 | ```vue
114 |
115 |
116 |
117 |
118 |
119 |
138 | ```
139 |
140 | ## Center markers in the middle of the map
141 |
142 | If you want to zoom in on the map as far as you can, but still see all markers, reference this code snippet.
143 |
144 | ```vue
145 |
186 |
187 |
188 |
189 |
194 |
195 |
196 |
197 | ```
198 |
199 | ### Cluster
200 |
201 | If you have too many markers, it is helpful to cluster markers. You can easily cluster markers by wrapping your markers with `GMapCluster` component.
202 |
203 | Note: clusters were not working in the original version of this package. All of the clusters are here because of the community fixes. If you're having trouble with it please [try using the docs](https://vue-google-maps-community-fork.netlify.app/components/cluster.html). Also, feel free to open discussions or issues to get help.
204 |
205 | ```vue
206 |
207 |
208 |
209 |
217 |
218 |
219 |
220 |
238 | ```
239 |
240 | ### Heatmap
241 |
242 | If you need to add heatmap layer to the Map, add visualization library in load config and add GMapHeatmap as child of GMapMap component.
243 |
244 | ```js
245 | import { createApp } from 'vue'
246 | import VueGoogleMaps from '@fawmi/vue-google-maps'
247 |
248 | const app = createApp(App)
249 | app
250 | .use(VueGoogleMaps, {
251 | load: {
252 | key: 'YOUR_API_KEY_COMES_HERE',
253 | libraries: 'visualization',
254 | },
255 | })
256 | .mount('#app')
257 | ```
258 |
259 | ```vue
260 |
261 |
262 |
263 |
264 |
265 |
293 | ```
294 |
295 | Checkout docs for more component
296 |
297 | ## Access map object
298 |
299 | If you want to access `google map` object, you can access it by getting ref of the map object.
300 |
301 | ```vue
302 |
303 |
304 |
305 |
312 | ```
313 |
314 | ### Map options
315 |
316 | You can pass Map options using options property:
317 |
318 | See [MapOptions](https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions) for a complete list of available options.
319 |
320 | ```vue
321 |
332 |
333 | ```
334 |
335 | ## More components
336 |
337 | Many other components are also supported. Checkout [docs](https://vue-map.netlify.app) for more.
338 |
339 | ## Nuxt 3 usage
340 |
341 | Warning: this is part of the old documentation and I never used Nuxt, please let me know if it will work properly this way.
342 |
343 | In order to your Nuxt 3 project work properly with this library, you need to add `vue-google-maps-community-fork` to `build.transpile` property in your `nuxt.config.ts`.
344 |
345 | Also, as pointed [here](https://github.com/NathanAP/vue-google-maps-community-fork/issues/14), you will need to add `@googlemaps/markercluster` into it as well for your builded project work properly.
346 |
347 | Here is an example:
348 |
349 | ```ts
350 | export default defineNuxtConfig({
351 | build: {
352 | transpile: ['vue-google-maps-community-fork', '@googlemaps/markercluster'],
353 | },
354 | })
355 | ```
356 |
357 | After that, you need to configure your plugin `~/plugin/vueGoogleMaps.ts`.
358 |
359 | ```ts
360 | import { defineNuxtPlugin } from '#app'
361 | import VueGoogleMaps from 'vue-google-maps-community-fork'
362 |
363 | export default defineNuxtPlugin((nuxtApp) => {
364 | nuxtApp.vueApp.use(VueGoogleMaps, {
365 | load: {
366 | key: 'YOUR_API_KEY_COMES_HERE',
367 | },
368 | })
369 | })
370 | ```
371 |
372 | ## Sponsorship
373 |
374 | Please read [this discussion](https://github.com/NathanAP/vue-google-maps-community-fork/discussions/1) where we talk about sponsorships.
375 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | [
4 | '@babel/preset-env',
5 | {
6 | useBuiltIns: 'usage', // adds specific imports for polyfills when they are used in each file.
7 | modules: false, // preserve ES modules.
8 | corejs: { version: 3, proposals: true }, // enable polyfilling of every proposal supported by core-js.
9 | },
10 | ],
11 | ],
12 | plugins: [
13 | '@babel/plugin-transform-runtime', // enables the re-use of Babel's injected helper code to save on codesize.
14 | ],
15 | exclude: [/core-js/],
16 | }
17 |
--------------------------------------------------------------------------------
/build-copy.js:
--------------------------------------------------------------------------------
1 | /* copies the components to the dist directory */
2 | require('shelljs/global')
3 |
4 | cp('src/components/infoWindow.vue', 'dist/components/')
5 | cp('src/components/map.vue', 'dist/components/')
6 | cp('src/components/placeInput.vue', 'dist/components/')
7 | cp('src/components/autocomplete.vue', 'dist/components/')
8 | cp('src/components/streetViewPanorama.vue', 'dist/components/')
9 |
--------------------------------------------------------------------------------
/docs/.npmignore:
--------------------------------------------------------------------------------
1 | pids
2 | logs
3 | node_modules
4 | npm-debug.log
5 | coverage/
6 | run
7 | dist
8 | .DS_Store
9 | .nyc_output
10 | .basement
11 | config.local.js
12 | basement_dist
13 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-google-maps-community-fork-docs",
3 | "version": "0.2.0",
4 | "description": "Documentation for Vue Google Maps Community Fork",
5 | "main": "index.js",
6 | "authors": {
7 | "name": "Nathan A Paludo",
8 | "email": "natspaludo@gmail.com"
9 | },
10 | "repository": "NathanAP/vue-google-maps-community-fork",
11 | "scripts": {
12 | "dev": "vuepress dev src",
13 | "build": "vuepress build src"
14 | },
15 | "license": "MIT",
16 | "devDependencies": {
17 | "vuepress": "^1.9.7"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/components/Foo/Bar.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
16 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/config.js:
--------------------------------------------------------------------------------
1 | const { description } = require('../../package')
2 |
3 | module.exports = {
4 | /**
5 | * Ref:https://v1.vuepress.vuejs.org/config/#title
6 | */
7 | title: 'Vue 3 Google Maps - Community Fork',
8 | /**
9 | * Ref:https://v1.vuepress.vuejs.org/config/#description
10 | */
11 | description: description,
12 |
13 | /**
14 | * Extra tags to be injected to the page HTML `
`
15 | *
16 | * ref:https://v1.vuepress.vuejs.org/config/#head
17 | */
18 | head: [
19 | ['meta', { name: 'theme-color', content: '#2c3e50' }],
20 | ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
21 | ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
22 | ],
23 |
24 | /**
25 | * Theme configuration, here is the default theme configuration for VuePress.
26 | *
27 | * ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
28 | */
29 | themeConfig: {
30 | repo: '',
31 | editLinks: true,
32 | docsDir: '',
33 | editLinkText: '',
34 | logo: '/assets/logo.jpg',
35 | head: [['meta', { name: 'theme-color', content: '#2c3e50' }]],
36 | lastUpdated: false,
37 | nav: [
38 | {
39 | text: 'Docs',
40 | link: '/docs/',
41 | },
42 | {
43 | text: 'GitHub',
44 | link: 'https://github.com/NathanAP/vue-google-maps-community-fork',
45 | },
46 | {
47 | text: 'npm',
48 | link: 'https://www.npmjs.com/package/vue-google-maps-community-fork',
49 | },
50 | ],
51 | sidebar: [
52 | {
53 | title: 'Getting started',
54 | path: '/docs/',
55 | collapsable: false,
56 | sidebarDepth: 0,
57 | },
58 | {
59 | title: 'Components',
60 | collapsable: false,
61 | path: '/components/',
62 | sidebarDepth: 0,
63 | children: [
64 | '/components/map',
65 | '/components/marker',
66 | '/components/info-window',
67 | '/components/cluster',
68 | '/components/circle',
69 | '/components/polygon',
70 | '/components/polyline',
71 | '/components/rectangle',
72 | '/components/autocomplete',
73 | ],
74 | },
75 | {
76 | title: 'Examples',
77 | collapsable: false,
78 | sidebarDepth: 0,
79 | path: '/examples/',
80 | children: [
81 | '/examples/how-to-add-a-custom-button-to-map',
82 | '/examples/points-in-polygon',
83 | '/examples/how-to-access-google-maps-object',
84 | '/examples/how-to-add-custom-controls',
85 | '/examples/how-to-open-or-close-info-window-on-event',
86 | '/examples/using-custom-renderer-function-and-clustering-algorithm',
87 | ],
88 | },
89 | ],
90 | },
91 |
92 | /**
93 | * Apply plugins,ref:https://v1.vuepress.vuejs.org/zh/plugin/
94 | */
95 | plugins: ['@vuepress/plugin-back-to-top', '@vuepress/plugin-medium-zoom'],
96 | }
97 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/enhanceApp.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Client app enhancement file.
3 | *
4 | * https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
5 | */
6 |
7 | export default ({
8 | Vue, // the version of Vue being used in the VuePress app
9 | options, // the options for the root Vue instance
10 | router, // the router instance for the app
11 | siteData // site metadata
12 | }) => {
13 | // ...apply enhancements for the site.
14 | }
15 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/public/assets/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanAP/vue-google-maps-community-fork/cb642738492a46b3c9e691900c05c863eb771816/docs/src/.vuepress/public/assets/logo.jpg
--------------------------------------------------------------------------------
/docs/src/.vuepress/styles/index.styl:
--------------------------------------------------------------------------------
1 | /**
2 | * Custom Styles here.
3 | *
4 | * ref:https://v1.vuepress.vuejs.org/config/#index-styl
5 | */
6 |
7 | .home .hero img
8 | max-width 450px!important
9 |
--------------------------------------------------------------------------------
/docs/src/.vuepress/styles/palette.styl:
--------------------------------------------------------------------------------
1 | /**
2 | * Custom palette here.
3 | *
4 | * ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl
5 | */
6 |
7 | $accentColor = #2c3e50
8 | $textColor = #2c3e50
9 | $borderColor = #eaecef
10 | $codeBgColor = #282c34
11 |
--------------------------------------------------------------------------------
/docs/src/components/README.md:
--------------------------------------------------------------------------------
1 | # Components
2 |
3 | In this section you will find everything about the currently supported components:
4 |
5 | - [Map](./map.md)
6 |
7 | - [Marker](./marker.md)
8 |
9 | - [InfoWindow](./info-window.md)
10 |
11 | - [Cluster](./cluster.md)
12 |
13 | - [Circle](./circle.md)
14 |
15 | - [Polygon](./polygon.md)
16 |
17 | - [Polyline](./polyline.md)
18 |
19 | - [Rectangle](./rectangle.md)
20 |
21 | - [Autocomplete](./autocomplete.md)
22 |
--------------------------------------------------------------------------------
/docs/src/components/autocomplete.md:
--------------------------------------------------------------------------------
1 | # Autocomplete
2 |
3 | Here you will find some uses for Google Maps Autocomplete component:
4 |
5 | [[toc]]
6 |
7 | ## Pre-requisite: load places library
8 |
9 | Before using Autocomplete, you need to load the places library:
10 |
11 | ```js
12 | createApp(App)
13 | .use(VueGoogleMaps, {
14 | load: {
15 | key: 'YOUR_API_KEY_COMES_HERE',
16 | libraries: 'places',
17 | },
18 | })
19 | .mount('#app')
20 | ```
21 |
22 | ## Adding Autocomplete to your components
23 |
24 | You can add an Autocomplete to your `template` using `GMapAutocomplete` component:
25 |
26 | ```html
27 |
28 |
29 |
30 |
31 |
42 | ```
43 |
44 | ## Adding a custom input for autocomplete
45 |
46 | You can customize input for autocomplete.
47 |
48 | ```html
49 |
50 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
75 | ```
76 |
77 | ## Adding custom options
78 |
79 | You can pass Google Maps Autocomplete options using the prop `options`:
80 |
81 | ```html
82 |
83 |
90 |
91 | ```
92 |
--------------------------------------------------------------------------------
/docs/src/components/circle.md:
--------------------------------------------------------------------------------
1 | # Circle
2 |
3 | Here you will find some uses for Google Maps Circle component:
4 |
5 | [[toc]]
6 |
7 | ## Adding Circle to your Maps
8 |
9 | You can add circles to your Maps using `GMapCircle` component inside of `GMapMap` component:
10 |
11 | ```html
12 |
13 |
14 |
20 |
21 |
22 |
23 |
59 | ```
60 |
61 | ## Adding custom options
62 |
63 | You can pass Google Maps Circle options using the prop `options`:
64 |
65 | ```html
66 |
67 |
68 |
69 |
70 |
86 | ```
87 |
--------------------------------------------------------------------------------
/docs/src/components/cluster.md:
--------------------------------------------------------------------------------
1 | # Cluster
2 |
3 | Here you will find some uses for Google Maps Clusterers.
4 |
5 | [[toc]]
6 |
7 | ## Before everything
8 |
9 | Clustering your markers are only possible because of `@googlemaps/markerclusterer`! The community is thankful for your effort!
10 |
11 | ## Cluster your markers
12 |
13 | You can add clusters to your `GMapMarker` using `GMapCluster` component inside of `GMapMap` component:
14 |
15 | ```html
16 |
17 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
49 | ```
50 |
51 | ## Props
52 |
53 | You can pass the following props to control behavior of clusters:
54 |
55 | ### minimumClusterSize
56 |
57 | Defines the minimum distance of markers to cluster them:
58 |
59 | ```js
60 | :minimumClusterSize="2"
61 | ```
62 |
63 | ### styles
64 |
65 | Controls style and icon of clusters:
66 |
67 | ```js
68 | :styles="clusterIcon"
69 | ```
70 |
71 | ### zoomOnClick
72 |
73 | Defines whether clusters should zoom in, when clicked:
74 |
75 | ```js
76 | :zoomOnClick="true"
77 | ```
78 |
--------------------------------------------------------------------------------
/docs/src/components/info-window.md:
--------------------------------------------------------------------------------
1 | # Info window
2 |
3 | Here you will find some uses for Google Maps Info Window component:
4 |
5 | [[toc]]
6 |
7 | ## Adding info window to your Google Maps components
8 |
9 | You can create info window by passing a custom HTML or Vue components as the child of `GMapInfoWindow` component:
10 |
11 | ```html
12 |
13 |
14 |
15 |
I am in info window
16 |
17 |
18 |
19 |
20 | ```
21 |
22 | ## Opening or closing an Info window
23 |
24 | You can pass the `opened` prop to open or close a `GMapInfoWindow`:
25 |
26 | ```html
27 |
28 |
29 |
30 |
I am in info window
31 |
32 |
33 |
34 |
35 | ```
36 |
37 | ## Adding custom options
38 |
39 | You can pass any Google Maps Info Window component using the prop `options`:
40 |
41 | ```html
42 |
43 |
44 |
54 |
I am in info window
55 |
56 |
57 |
58 |
59 | ```
60 |
--------------------------------------------------------------------------------
/docs/src/components/map.md:
--------------------------------------------------------------------------------
1 | # Map
2 |
3 | Here is where you start. Here you will find some uses for Google Maps component:
4 |
5 | [[toc]]
6 |
7 | ## My first Google Maps component
8 |
9 | You can create a Google Map component using `GMapMap`:
10 |
11 | ```html
12 |
13 |
14 | ```
15 |
16 | Example on [Playcode](https://playcode.io/1041241)
17 |
18 | ## Styling your Google Maps component
19 |
20 | You can generate custom map styles at [https://mapstyle.withgoogle.com/](https://mapstyle.withgoogle.com/).
21 |
22 | You can provide custom styles by providing `style` property to the `options` prop:
23 |
24 | ```html
25 |
31 |
32 |
33 |
34 |
35 |
43 |
44 |
45 |
46 | ```
47 |
48 | Example on [Playcode](https://playcode.io/1041245)
49 |
50 | ### Cloud-based styles with Map ID
51 |
52 | You can manage your cloud-based styles on [Google Maps Platform: Map Styles](https://console.cloud.google.com/google/maps-apis/studio/styles), and your map ids on [Google Maps Platform: Map Management](https://console.cloud.google.com/google/maps-apis/studio/maps)
53 |
54 | [Documentation: Maps JavaScript API - Using Cloud-based maps styling](https://developers.google.com/maps/documentation/javascript/cloud-based-map-styling)
55 |
56 | ```html
57 |
58 |
65 |
66 |
67 |
68 |
80 | ```
81 |
82 | ## Disable UI elements
83 |
84 | You can disable all UI components at once:
85 |
86 | ```html
87 |
88 | ```
89 |
90 | You can also disable specific UI components:
91 |
92 | ```html
93 |
105 | ```
106 |
107 | ## Max and Min Zoom
108 |
109 | You can set the maximum and minimum zoom levels for the map:
110 |
111 | ```html
112 |
117 | ```
118 |
119 | - Max zoom specifies how far the user can zoom in, 18-20 is normally the max.
120 | - Min zoom is how far they can zoom out, 0-3 is normally the min.
121 |
122 |
123 | ## Access Google Maps instance
124 |
125 | You can easily access the Map instance by accessing `ref` in your component:
126 |
127 | ```html
128 |
134 | ```
135 |
--------------------------------------------------------------------------------
/docs/src/components/marker.md:
--------------------------------------------------------------------------------
1 | # Marker
2 |
3 | Here you will find some uses for Google Maps Marker component:
4 |
5 | [[toc]]
6 |
7 | ## Adding marker to your components
8 |
9 | You can add markers to your Maps using `GMapMarker` component inside of `GMapMap` component:
10 |
11 | ```html
12 |
13 |
14 |
15 |
16 |
17 |
18 |
35 | ```
36 |
37 | ## Enabling or disabling events
38 |
39 | You can enable or disable the Google Maps Marker events by passing `props`:
40 |
41 | ```html
42 |
43 |
44 |
51 |
52 |
53 | ```
54 |
55 | ## Registering events
56 |
57 | You can register events (like click) in the same way as you do in your Vue components:
58 |
59 | ```html
60 |
61 |
62 |
69 |
70 |
71 | ```
72 |
73 | ## Adding a custom icon
74 |
75 | You can use `:icon` prop to pass a custom icon to your `GMapMarker`. Also, you can pass a local resource or an image from internet:
76 |
77 | ```html
78 |
79 |
80 |
88 |
89 |
90 | ```
91 |
92 | Local resources can be passed in using `require`, for example: `:icon="require('@/assets/images/place-icon.svg').default"`.
93 |
94 | The `icon` prop also can receive an object to define custom size and label origin:
95 |
96 | ```html
97 |
98 |
99 |
111 |
112 |
113 | ```
114 |
--------------------------------------------------------------------------------
/docs/src/components/polygon.md:
--------------------------------------------------------------------------------
1 | # Polygon
2 |
3 | Here you will find some uses for Google Maps Polygon component:
4 |
5 | [[toc]]
6 |
7 | ## Adding Polygon to your Maps
8 |
9 | You can add polygons to your Maps using `GMapPolygon` component inside of `GMapMap` component:
10 |
11 | ```html
12 |
13 |
14 |
15 |
16 |
17 |
32 | ```
33 |
34 | ## Adding custom options
35 |
36 | You can pass Google Maps Polygon options using the prop `options`:
37 |
38 | ```html
39 |
40 |
41 |
42 |
43 |
44 |
45 |
61 | ```
62 |
--------------------------------------------------------------------------------
/docs/src/components/polyline.md:
--------------------------------------------------------------------------------
1 | # Polyline
2 |
3 | Here you will find some uses for Google Maps Polyline component:
4 |
5 | [[toc]]
6 |
7 | ## Adding Polyline to your Maps
8 |
9 | You can add polygons to your Maps using `GMapPolyline` component inside of `GMapMap` component:
10 |
11 | ```html
12 |
13 |
14 |
15 |
16 |
30 | ```
31 |
32 | ## Making polyline editable
33 |
34 | You can make your `GMapPolyline` component editable using `editable` prop:
35 |
36 | ```html
37 |
38 |
39 |
40 |
41 |
42 |
43 |
51 | ```
52 |
53 | ## Adding custom options
54 |
55 | You can pass Google Maps Polyline options using the prop `options`:
56 |
57 | ```html
58 |
59 |
60 |
61 |
62 |
63 |
64 |
74 | ```
75 |
--------------------------------------------------------------------------------
/docs/src/components/rectangle.md:
--------------------------------------------------------------------------------
1 | # Rectangle
2 |
3 | Here you will find some uses for Google Maps Rectangle component:
4 |
5 | [[toc]]
6 |
7 | ## Adding Rectangle to your Maps
8 |
9 | You can add polygons to your Maps using `GMapRectangle` component inside of `GMapMap` component:
10 |
11 | ```html
12 |
13 |
14 |
15 |
16 |
17 |
18 |
34 | ```
35 |
36 | ## Adding custom options
37 |
38 | You can pass Google Maps Rectangle options using the prop `options`:
39 |
40 | ```html
41 |
42 |
43 |
44 |
45 |
46 |
47 |
70 | ```
71 |
--------------------------------------------------------------------------------
/docs/src/components/using-vue.md:
--------------------------------------------------------------------------------
1 | # Using Vue in Markdown
2 |
3 | ## Browser API Access Restrictions
4 |
5 | Because VuePress applications are server-rendered in Node.js when generating static builds, any Vue usage must conform to the [universal code requirements](https://ssr.vuejs.org/en/universal.html). In short, make sure to only access Browser / DOM APIs in `beforeMount` or `mounted` hooks.
6 |
7 | If you are using or demoing components that are not SSR friendly (for example containing custom directives), you can wrap them inside the built-in `` component:
8 |
9 | ##
10 |
--------------------------------------------------------------------------------
/docs/src/config/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar: auto
3 | ---
4 |
5 | # Config
6 |
7 | ## foo
8 |
9 | - Type: `string`
10 | - Default: `/`
11 |
12 | ## bar
13 |
14 | - Type: `string`
15 | - Default: `/`
16 |
--------------------------------------------------------------------------------
/docs/src/docs/README.md:
--------------------------------------------------------------------------------
1 | # Getting started
2 |
3 | Welcome! In `vue-google-maps-community-fork` will you find a set of VueJS 3 components wrapping the Google Maps API.
4 |
5 | ## Before starting
6 |
7 | It is important to notice that this repository was forked by the community to keep the library alive. You can get more infor about our decision [in this GitHub discussion](https://github.com/NathanAP/vue-google-maps-community-fork/discussions/1).
8 |
9 | Since this library is currently maintained by the community, every help is needed and appreciated! You can follow everything in our [GitHub repository](https://github.com/NathanAP/vue-google-maps-community-fork).
10 |
11 | ## Installation
12 |
13 | You can install this library using npm:
14 |
15 | ```
16 | npm install vue-google-maps-community-fork
17 | ```
18 |
19 | ### Pre-requisites
20 |
21 | To use this library you will need an API Key. You can learn how to get one [here](https://developers.google.com/maps/documentation/javascript/get-api-key).
22 |
23 | ### Configuration for Nuxt
24 |
25 | Warning: this is part of the old documentation and I never used Nuxt, please let me know if it will work properly this way.
26 |
27 | In order to your Nuxt 3 project work properly with this library, you need to add `vue-google-maps-community-fork` to `build.transpile` property in your `nuxt.config.ts`.
28 |
29 | Also, as pointed [here](https://github.com/NathanAP/vue-google-maps-community-fork/issues/14), you will need to add `@googlemaps/markercluster` into it as well for your builded project work properly.
30 |
31 | ```ts
32 | export default defineNuxtConfig({
33 | build: {
34 | transpile: ['vue-google-maps-community-fork', '@googlemaps/markercluster'],
35 | },
36 | })
37 | ```
38 |
39 | ### Configure your enviroment
40 |
41 | Initialise the plugin in your `main.js`:
42 |
43 | ```js
44 | import { createApp } from 'vue'
45 | import VueGoogleMaps from 'vue-google-maps-community-fork'
46 |
47 | const app = createApp(App)
48 | app
49 | .use(VueGoogleMaps, {
50 | load: {
51 | key: 'YOUR_API_KEY_COMES_HERE',
52 | },
53 | })
54 | .mount('#app')
55 | ```
56 |
57 | ### Great! Now you can use anywhere in your components
58 |
59 | Here are some examples:
60 |
61 | ```vue
62 |
63 |
69 |
70 |
71 |
72 |
82 | ```
83 |
84 | ## Registering Google Maps events
85 |
86 | To use Google Maps events you have two options:
87 |
88 | - The first (and better) option is to activate them when you need.
89 |
90 | In this example, we enable `closeclick` event for `GMapInfoWindow` component and register the event.
91 |
92 | ```html
93 |
94 |
I am in info window {{ m.id }}
95 |
96 | ```
97 |
98 | - The second option is to enable them globally.
99 |
100 | ```js
101 | import { createApp } from 'vue'
102 | import VueGoogleMaps from 'vue-google-maps-community-fork'
103 |
104 | const app = createApp(App)
105 | app
106 | .use(VueGoogleMaps, {
107 | load: {
108 | key: 'YOUR_API_KEY_COMES_HERE',
109 | },
110 | autobindAllEvents: true, // Add this to enable the events
111 | })
112 | .mount('#app')
113 | ```
114 |
--------------------------------------------------------------------------------
/docs/src/examples/README.md:
--------------------------------------------------------------------------------
1 | # Examples
2 |
3 | Here you will find some basic examples that might be useful for you.
4 |
5 | - [How to add a custom button to my map](./how-to-add-a-custom-button-to-map.md)
6 |
7 | - [How to get if a clicked area is within polygon in Google Maps](./points-in-polygon.md)
8 |
9 | - [How to access Google Maps object](./how-to-access-google-maps-object.md)
10 |
11 | - [How to add custom controls](./how-to-add-custom-controls.md)
12 |
13 | - [How to open or close an Info window on event](./how-to-open-or-close-info-window-on-event.md)
14 |
15 | - [Using custom renderer function and clustering algorithm](./using-custom-renderer-function-and-clustering-algorithm.md)
16 |
--------------------------------------------------------------------------------
/docs/src/examples/how-to-access-google-maps-object.md:
--------------------------------------------------------------------------------
1 | # How to access Google Maps object
2 |
3 | [Interactive example on Playcode](https://playcode.io/1041251)
4 |
5 | To access Google maps object, or do something when map is loaded, use a ref on the `GMapMap` object.
6 |
7 | ## Example
8 |
9 | ```html
10 |
20 |
21 |
22 |
23 |
24 |
32 |
33 |
34 |
35 | ```
36 |
--------------------------------------------------------------------------------
/docs/src/examples/how-to-add-a-custom-button-to-map.md:
--------------------------------------------------------------------------------
1 | # Adding a custom button to my map
2 |
3 | You can use the map instance to add custom buttons to your map:
4 |
5 | ```html
6 |
7 |
13 |
14 |
15 |
50 | ```
51 |
--------------------------------------------------------------------------------
/docs/src/examples/how-to-add-custom-controls.md:
--------------------------------------------------------------------------------
1 | # How to add custom controls
2 |
3 | [Interactive example on Playcode](https://playcode.io/1041257)
4 |
5 | To add custom controls, you can access google maps object and add controls to it, look at this example or follow the interactive example on CodeSandbox above.
6 |
7 | ## Example
8 |
9 | ```html
10 |
11 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
95 | ```
96 |
--------------------------------------------------------------------------------
/docs/src/examples/how-to-open-or-close-info-window-on-event.md:
--------------------------------------------------------------------------------
1 | # How to open or close an info window on event
2 |
3 | [Interactive example on Playcode](https://playcode.io/1041264).
4 |
5 | To open or close info windows after marker click, you can modify the `:opened` prop and maintain a state variable containing ID of the opened marker.
6 |
7 | ```html
8 |
34 |
35 |
36 |
37 |
45 |
50 |
I am in info window {{ m.id }}
51 |
52 |
53 |
54 |
55 |
56 |
61 | ```
62 |
--------------------------------------------------------------------------------
/docs/src/examples/introduction.md:
--------------------------------------------------------------------------------
1 | # Advanced
2 |
3 | `@fawmi/vue-google-maps` provides a set of Vue.js 3 components wrapping the Google Maps API v3.
4 |
5 | Currently `Map`, `Marker`, `InfoWindow`, `Polyline`, `Polygon` and `Rectangle` are supported.
6 |
7 | Other components are still under development.
8 |
9 | Checkout getting started to read, how to install and use vue-google-maps
10 |
--------------------------------------------------------------------------------
/docs/src/examples/points-in-polygon.md:
--------------------------------------------------------------------------------
1 | # How to get if a clicked area is within polygon in Google Maps
2 |
3 | [Interactive example on Playcode](https://playcode.io/1041268)
4 |
5 | ## Example
6 |
7 | ```html
8 |
9 |
10 |
19 |
27 |
28 |
29 |
30 |
72 | ```
73 |
--------------------------------------------------------------------------------
/docs/src/examples/using-custom-renderer-function-and-clustering-algorithm.md:
--------------------------------------------------------------------------------
1 | # Using custom renderer function and clustering algorithm
2 |
3 | In order to use custom renderer functions or clustering algorithms, you will need to do the following step before:
4 |
5 | ## Install `@googlemaps/markerclusterer` package into your own project
6 |
7 | Use `npm install @googlemaps/markerclusterer` to install the library into your project.
8 |
9 | Note: this is required because it was the best option for us to make Clustering viable. The original version of this library wasn't supporting the new MarkerClustering package version, so we had to make adjustments. You can read more about it in [this PR](https://github.com/NathanAP/vue-google-maps-community-fork/pull/19).
10 |
11 | ## Example
12 |
13 | Following this example will help you create your own render function and clustering algorithm.
14 |
15 | ```html
16 |
17 |
24 |
25 |
33 |
34 |
35 |
36 |
71 | ```
72 |
--------------------------------------------------------------------------------
/docs/src/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | heroImage: 'assets/logo.jpg'
4 | tagline: A library that contains Google Maps reactive components for VueJS 3
5 | actionText: Read Docs
6 | actionLink: /docs/
7 | ---
8 |
9 |
9 |
10 |
11 |
222 |
229 |
--------------------------------------------------------------------------------
/src/components/mapElementMixin.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @class MapElementMixin
3 | *
4 | * Extends components to include the following fields:
5 | *
6 | * @property $map The Google map (valid only after the promise returns)
7 | *
8 | *
9 | * */
10 | export default {
11 | inject: {
12 | $mapPromise: { default: 'abcdef' },
13 | },
14 |
15 | provide() {
16 | // Note: although this mixin is not "providing" anything,
17 | // components' expect the `$map` property to be present on the component.
18 | // In order for that to happen, this mixin must intercept the $mapPromise
19 | // .then(() =>) first before its component does so.
20 | //
21 | // Since a provide() on a mixin is executed before a provide() on the
22 | // component, putting this code in provide() ensures that the $map is
23 | // already set by the time the
24 | // component's provide() is called.
25 | this.$mapPromise.then((map) => {
26 | this.$map = map
27 | })
28 |
29 | return {}
30 | },
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/marker.vue:
--------------------------------------------------------------------------------
1 |
2 |