68 |
69 | ## Attributes
70 |
71 | | Attribute | Type | Description |
72 | | ----- | ----- | ----- |
73 | | settings | Object | Settings of map. API Key, language and version. |
74 | | coords | Array | Map center coordinates. [ lat, lng ]. May use with `.sync`. *Required* |
75 | | map-events | Array | Native events, which map emits. If not provided, map will be emit all events, from section [Events](#events) | All |
76 | | zoom | Number | Zoom map value (from 0 to 19). May use with `.sync`. *Default: 18*. |
77 | | bounds | Array | Coordinates of the left bottom and right top corners of the map. If defined, `coords` and `center` are ignored. May use with `.sync`. |
78 | | [cluster-options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/ClusterPlacemark-docpage/#param-options) | Object | An object where the keys are the names of the clusters, and the values are the objects of options these clusters. In options you can point field `layout` (type `String`) for HTML template for `balloonItemContentLayout`, field `clusterIconContentLayout` (type `String`) for cluster icon customization and field `clusterBalloonLayout` (type `String`) for cluster balloon customization: [Custom Balloon example](https://tech.yandex.ru/maps/jsbox/2.1/cluster_custom_balloon_content_layout). There is also `createCluster` field for overriding default creating cluster function (field `use-object-manager` have to be turned off).|
79 | | cluster-callbacks | Object | An object where the keys are the names of the clusters, and the values are the objects of events these clusters, e.g. `{ clusterName: { click: function() {...}, contextmenu: anotherFunction } }` |
80 | | [behaviors](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/map.behavior.Manager-docpage/#param-behaviors) | Array | Array of connected map behaviors. All other values are considered off.|
81 | | [controls](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.Manager-docpage/#add-param-control) | Array | Array of connected map controls. All other values are considered offth.|
82 | | detailed-controls | Object | An object where the keys are the elements of map control, and the values are the objects of element settings. Designed for fine setting of control elements. |
83 | | map-type | String | Map type. Valid values: `map, satellite, hybrid`. *Default: map*. |
84 | | scroll-zoom | Boolean | Set `false` to disable map zoom on the page when you are scrolling. *Default: true* |
85 | | placemarks | Array of Objects | **Deprecated**. Use marker component |
86 | | use-object-manager | Boolean | Set `true` for use Object Manager. Used if there is huge count of markers on the map. *Default: false* |
87 | | object-manager-clusterize | Boolean | Clustering with Object Manager. *Default: true* |
88 | | ymap-class | String | Defines class for element, where rendering the map instance. If the attribute is not defined, the element uses style: `width: 100%; height: 100%;` |
89 | | init-without-markers | Boolean | Set to `false` for prevent init and render map if there are no markers on the map. Default: `true` |
90 | | show-all-markers | Boolean | Set to `true` to initialize map with all markers inside map bounds. Default: `false` |
91 | | use-html-in-layout | Boolean | Set to `true` to define balloon properties as html. Default: `false` |
92 | | [options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options) | Object | Map options. |
93 | | balloon-component | Vue Component | Allow to use Vue Component as balloon. Need to activate [runtimeCompiler](https://cli.vuejs.org/config/#runtimecompiler). **Vue 2 only**|
94 |
--------------------------------------------------------------------------------
/docs/en/guide/Marker.md:
--------------------------------------------------------------------------------
1 | # Marker
2 |
3 | You can define map markers by using component ``.
4 |
5 | ::: danger Attention!
6 | Since version `0.10` you can define markers through `ymap-marker` only. Map attribute `placemarks` not supported
7 | :::
8 |
9 | ::: tip Take a look,
10 | For each marker you need to add property `markerId`
11 | :::
12 |
13 | You can indicate marker type by using attribute `marker-type`. Allowable values:
14 | * Placemark
15 | * Polyline
16 | * Rectangle
17 | * Polygon
18 | * Circle
19 |
20 | ## Events
21 |
22 |
'
12 | }
13 | })
14 | }
--------------------------------------------------------------------------------
/docs/examples/custom-icon/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/examples/load-ymap/script.js:
--------------------------------------------------------------------------------
1 | import { loadYmap } from 'vue-yandex-maps';
2 |
3 | export default {
4 | async mounted() {
5 | const settings = { lang: 'en_US' };
6 | await loadYmap(settings);
7 | console.log(ymaps); // здесь доступен весь функционал ymaps
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/docs/guide/Map.md:
--------------------------------------------------------------------------------
1 | # Карта
2 | После подключения плагина вы можете использовать компонент `` для работы с картой. Параметры карты задаются через атрибуты. Вы можете получить доступ к [инстансу карты](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/Map-docpage/) для работы напрямую с [API Я.Карт](https://tech.yandex.ru/maps/doc/jsapi/2.1/quick-start/index-docpage/), слушая событие `map-was-initialized`. Ссылка на инстанс будет передана как payload события.
3 |
4 | Вы можете задать класс элементу, в котором непосредственно находится карта через аттрибут `ymap-class`. Если этот атрибут не задан - элементу присваивается аттрибут `style="width: 100%; height: 100%;"`.
5 |
6 | По умолчанию маркеры добавляются на карту через `GeoObjectCollection`, но при большом количестве маркеров отрисовка карты может занимать продолжительное время даже при группировке маркеров в кластеры. В таком случае рекомендуется использовать `ObjectManager`, указав атрибут карты `useObjectManager`. Но в этом случае вы теряете возможность слушать события у каждого отдельного маркера.
7 |
8 | Атрибуты карты `coords`, `bounds` и `zoom` являются наблюдаемыми. Карта реагирует на их изменения.
9 |
10 | ## Events
11 |
12 |
68 |
69 | ## Attributes
70 |
71 | | Attribute | Type | Description |
72 | | ----- | ----- | ----- |
73 | | settings | Object | Настройки карты. API Key, язык и версия. |
74 | | coords | Array | Координаты центра карты. [ lat, lng ]. Может принимать модификатор `.sync`. *Required* |
75 | | map-events | Array | Нативные события (события Я.Карт), которые эмитит карта. Если не задано, то карта будет эмитить все события, перечисленные в секции [Events](#events) |
76 | | zoom | Number | Значение зума карты (от 0 до 19). Может принимать модификатор `.sync`. *Default: 18*. |
77 | | bounds | Array | Координаты левого нижнего и правого верхнего углов карты. Если аттрибут задан, то значения `coords` и `center` игнорируются. Может принимать модификатор `.sync`. |
78 | | [cluster-options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/ClusterPlacemark-docpage/#param-options) | Object | Объект, где ключами являются имена кластеров, а значениями - объекты опций этих кластеров. Объект принимает поле `layout` (тип `String`) со строковым представлением HTML темплейта для `balloonItemContentLayout`, поле `clusterIconContentLayout` (тип `String`) для кастомизации иконки кластера и поле `clusterBalloonLayout` (тип `String`) для кастомизации балуна кластера: [Custom Balloon example](https://tech.yandex.ru/maps/jsbox/2.1/cluster_custom_balloon_content_layout). Также здесь можно передать переопределенную функцию `createCluster` для добавления своей логики при создание кластеров (опция `use-object-manager` при этом должна быть отключена).|
79 | | cluster-callbacks | Object | Объект, где ключами являются имена кластеров, а значениями - объекты событий этих кластеров, напр. `{ clusterName: { click: function() {...}, contextmenu: anotherFunction } }` |
80 | | [behaviors](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/map.behavior.Manager-docpage/#param-behaviors) | Array | Массив подключенных поведений карты. Все остальные значения считаются выключенными.|
81 | | [controls](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.Manager-docpage/#add-param-control) | Array | Массив подключенных элементов управления картой. Все остальные значения считаются выключенными.|
82 | | detailed-controls | Object | Объект, где ключами являются элементы управления картой, а значениями - объекты настроект элемента. Предназначен для тонкой настройки элементов управления. |
83 | | map-type | String | Тип карты. Допустимые значения: `map, satellite, hybrid`. *Default: map*. |
84 | | scroll-zoom | Boolean | Установите в значение `false`, чтобы при прокрутке страницы у карты не срабатывал зум. *Default: true* |
85 | | placemarks | Array of Objects | **Deprecated**. Используйте компонент маркера |
86 | | use-object-manager | Boolean | Установите в значение `true` для использования Object Mananger. Используйте при большом количестве маркеров на карте. *Default: false* |
87 | | object-manager-clusterize | Boolean | Кластеризация при использовании Object Mananger. *Default: true* |
88 | | ymap-class | String | Определяет класс для элемента, где рендерится инстанс карты. Если аттрибут не определен - элемент использует стиль: `width: 100%; height: 100%;` |
89 | | init-without-markers | Boolean | Установите значение в `false`, чтобы карта не отображалась при отсутствии маркеров. Default: `true` |
90 | | show-all-markers | Boolean | Установите значение в `true`, чтобы границы карты при инициализации вмещали все маркеры. Default: `false` |
91 | | use-html-in-layout | Boolean | Установите значение в `true`, чтобы передавать в поля в балун в виде html-разметки. Default: `false` |
92 | | [options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options) | Object | Опции карты |
93 | | balloon-component | Vue Component | Позволяет использовать компонент Vue в качестве балуна. Для работы необходима активация [runtimeCompiler](https://cli.vuejs.org/config/#runtimecompiler). **Только для Vue 2**|
94 |
--------------------------------------------------------------------------------
/docs/guide/Marker.md:
--------------------------------------------------------------------------------
1 | # Маркер
2 |
3 | Вы можете задать маркеры для карты, используя компонент ``.
4 |
5 | ::: danger Важно!
6 | Начиная с версии `0.10` маркеры можно задавать только используя компонент `ymap-marker`. Атрибут карты `placemarks` не поддерживается.
7 | :::
8 |
9 | ::: tip Обратите внимание
10 | Для каждого маркера является обязательным указание свойста `markerId`
11 | :::
12 |
13 | Вы можете указать тип маркера, используя атрибут `marker-type`. Допустимые значения:
14 | * Placemark
15 | * Polyline
16 | * Rectangle
17 | * Polygon
18 | * Circle
19 |
20 | ## Events
21 |
22 |
71 |
72 | ::: danger Важно!
73 | Начиная с версии `0.10` атрибут `callbacks` не поддерживается. Слушайте события у компонента.
74 | :::
75 |
76 | ## Attributes
77 |
78 | | Attribute | Type | Description | Marker-types |
79 | | ----- | ----- | ----- | ----- |
80 | | marker-id | String, Number | Id маркера. `Required` ||
81 | | marker-type | String | Тип маркера. Default: `Placemark` ||
82 | | coords | Array [ latitude, longitude ] | Координаты маркера или центр круга. `Required` | Placemark, Circle |
83 | | coords | Array of arrays [ [latitude, longitude], [...] ] | Координаты вершин. `Required` | Rectangle, Polyline |
84 | | coords | Array of two arrays of coordinates arrays (first for outer contour, second for inner) [ [[latitude, longitude], [...]], [[...], [...]] ] | Координаты вершин. `Required` | Polygon |
85 | | marker-events | Array | Нативные события (события Я.Карт), которые эмитит маркер. Если не задано, то маркер будет эмитить все события, перечисленные в секции [Events](#events) | All |
86 | | hint-content | String | Содержимое подсказки | All |
87 | | balloon | Object | Свойства балуна: header, body, footer | All |
88 | | [icon](#icons) | Object | Иконка маркера | Placemark |
89 | | marker-fill | Object | Свойства заливки: enabled, color, opacity, imageHref | Polygon, Rectangle, Circle |
90 | | marker-stroke | Object | Свойства обводки: color, opacity, width, style | Polygon, Rectangle, Circle, Polyline |
91 | | circle-radius | Number | Радиус окружности в метрах. Default: `1000`. | Circle |
92 | | cluster-name | String | Имя кластера для группировки маркеров | All |
93 | | properties | Object | [Свойства маркера](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject-docpage/#param-feature.properties) | All |
94 | | options | Object | [Опции маркера](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject-docpage/#param-options) | All |
95 | | [balloon-template](/examples/#кастомный-темпnейт-баnуна) | String | HTML Template for balloon | All |
96 | | balloon-component-props | Object | Объект пропсов для балуна. _Только при инициализации балуна через balloonComponent_ | All |
97 |
98 | ## Slots
99 |
100 | Вы можете передать темплейт балуна для маркера, используя слот `balloon`. Вы также можете поместить в этот слот компонент, но имейте ввиду, что в балун передается только представление компонента, его визуальная часть. Если вы хотите использовать какую-то логику (например действие по нажатию на кнопку внутри балуна), то вы можете использовать событие маркера `balloonopen` и навешивать любые обработчики на элементы вашего балуна. Не забудьте удалить обработчики при наступлении события `balloonclose`. [Пример](/examples/#испоnьзование-сnота-баnуна-в-маркере)
101 | Также Вы можете определить макет балуна через слот `balloonLayout` в маркере. Содержимое данного слота заменит содержание стандартного макета для балуна. Будьте осторожны, если вы используете слот `balloonLayout`, слот `balloon` будет игнорироваться.
102 |
103 | ## Icons
104 |
105 | Вы можете задать настройки иконки маркера следующими полями: color (default: 'blue'), content, glyph. Свойство `glyph` имеет более высокий приоритете, чем `content`. [Список цветов и иконок](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage-docpage/). В этом случае вы получаете классический вид маркера.
106 |
107 | Вы можете также задать вашу собственную иконку для маркера. В этом случае объект настроек должен выглядеть следующим образом:
108 |
109 | ```JavaScript
110 | {
111 | layout: 'default#image', // 'default#imageWithContent' для использования с контентом
112 | imageHref: markerIcon, // адрес изображения или data:image/svg+xml;base64
113 | imageSize: [43, 55], // размер иконки в px
114 | imageOffset: [-22, -55], // смещение иконки в px,
115 | /* Следующие поля актуальны для layout: 'default#imageWithContent' */
116 | content: 'some content here', // содержимое контента
117 | contentOffset: [-22, -55], // смещение контента в px,
118 | contentLayout: '
8 |
9 |
10 |
80 |
--------------------------------------------------------------------------------
/examples/Nuxt/components/README.md:
--------------------------------------------------------------------------------
1 | # COMPONENTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | The components directory contains your Vue.js Components.
6 |
7 | _Nuxt.js doesn't supercharge these components._
8 |
--------------------------------------------------------------------------------
/examples/Nuxt/layouts/README.md:
--------------------------------------------------------------------------------
1 | # LAYOUTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Application Layouts.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
8 |
--------------------------------------------------------------------------------
/examples/Nuxt/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
56 |
--------------------------------------------------------------------------------
/examples/Nuxt/middleware/README.md:
--------------------------------------------------------------------------------
1 | # MIDDLEWARE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your application middleware.
6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
7 |
8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
9 |
--------------------------------------------------------------------------------
/examples/Nuxt/nuxt.config.js:
--------------------------------------------------------------------------------
1 | import pkg from './package';
2 |
3 | export default {
4 | mode: 'universal',
5 |
6 | /*
7 | ** Headers of the page
8 | */
9 | head: {
10 | title: pkg.name,
11 | meta: [
12 | { charset: 'utf-8' },
13 | { name: 'viewport', content: 'width=device-width, initial-scale=1' },
14 | { hid: 'description', name: 'description', content: pkg.description }
15 | ],
16 | link: [
17 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
18 | ]
19 | },
20 |
21 | /*
22 | ** Customize the progress-bar color
23 | */
24 | loading: { color: '#fff' },
25 |
26 | /*
27 | ** Global CSS
28 | */
29 | css: [
30 | ],
31 |
32 | /*
33 | ** Plugins to load before mounting the App
34 | */
35 | plugins: [
36 | { src: '~/plugins/ymapPlugin.js', mode: 'client' },
37 | ],
38 |
39 | /*
40 | ** Nuxt.js modules
41 | */
42 | modules: [
43 | ],
44 |
45 | /*
46 | ** Build configuration
47 | */
48 | build: {
49 | /*
50 | ** You can extend webpack config here
51 | */
52 | extend(config, ctx) {
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/examples/Nuxt/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt",
3 | "version": "1.0.0",
4 | "description": "Yandex Maps Nuxt example",
5 | "author": "Pavel Galkin",
6 | "private": true,
7 | "scripts": {
8 | "dev": "nuxt",
9 | "build": "nuxt build",
10 | "start": "nuxt start",
11 | "generate": "nuxt generate"
12 | },
13 | "dependencies": {
14 | "cross-env": "^5.2.0",
15 | "nuxt": "^2.4.0",
16 | "vue-yandex-maps": "^0.8.4"
17 | },
18 | "devDependencies": {
19 | "nodemon": "^1.18.9"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/examples/Nuxt/pages/README.md:
--------------------------------------------------------------------------------
1 | # PAGES
2 |
3 | This directory contains your Application Views and Routes.
4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application.
5 |
6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
7 |
--------------------------------------------------------------------------------
/examples/Nuxt/pages/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
23 |
24 |
29 |
--------------------------------------------------------------------------------
/examples/Nuxt/plugins/README.md:
--------------------------------------------------------------------------------
1 | # PLUGINS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
8 |
--------------------------------------------------------------------------------
/examples/Nuxt/plugins/ymapPlugin.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import YmapPlugin from 'vue-yandex-maps'
3 |
4 | const settings = {
5 | lang: 'ru_RU'
6 | }
7 |
8 | Vue.use(YmapPlugin, settings);
--------------------------------------------------------------------------------
/examples/Nuxt/static/README.md:
--------------------------------------------------------------------------------
1 | # STATIC
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your static files.
6 | Each file inside this directory is mapped to `/`.
7 | Thus you'd want to delete this README.md before deploying to production.
8 |
9 | Example: `/static/robots.txt` is mapped as `/robots.txt`.
10 |
11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
12 |
--------------------------------------------------------------------------------
/examples/Nuxt/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yandex-maps-unofficial/vue-yandex-map/00724e276baf643e782d5b33d433f4782b5fcd5f/examples/Nuxt/static/favicon.ico
--------------------------------------------------------------------------------
/examples/Nuxt/store/README.md:
--------------------------------------------------------------------------------
1 | # STORE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Vuex Store files.
6 | Vuex Store option is implemented in the Nuxt.js framework.
7 |
8 | Creating a file in this directory automatically activates the option in the framework.
9 |
10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
11 |
--------------------------------------------------------------------------------
/examples/Vue/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 | package-lock.json
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/examples/Vue/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Run your tests
19 | ```
20 | npm run test
21 | ```
22 |
23 | ### Lints and fixes files
24 | ```
25 | npm run lint
26 | ```
27 |
28 | ### Customize configuration
29 | See [Configuration Reference](https://cli.vuejs.org/config/).
30 |
--------------------------------------------------------------------------------
/examples/Vue/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/examples/Vue/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "core-js": "^2.6.5",
11 | "vue": "^2.6.10",
12 | "vue-yandex-maps": "^0.8.4"
13 | },
14 | "devDependencies": {
15 | "@vue/cli-plugin-babel": "^3.7.0",
16 | "@vue/cli-service": "^3.7.0",
17 | "vue-template-compiler": "^2.5.21"
18 | },
19 | "postcss": {
20 | "plugins": {
21 | "autoprefixer": {}
22 | }
23 | },
24 | "browserslist": [
25 | "> 1%",
26 | "last 2 versions"
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/examples/Vue/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yandex-maps-unofficial/vue-yandex-map/00724e276baf643e782d5b33d433f4782b5fcd5f/examples/Vue/public/favicon.ico
--------------------------------------------------------------------------------
/examples/Vue/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | example
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/Vue/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
47 |
80 |
81 |
--------------------------------------------------------------------------------
/examples/vue3/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/examples/vue3/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/vue3-essential',
8 | 'eslint:recommended'
9 | ],
10 | parserOptions: {
11 | parser: 'babel-eslint'
12 | },
13 | rules: {
14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/examples/vue3/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
15 |
16 | # Editor directories and files
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw?
24 |
--------------------------------------------------------------------------------
/examples/vue3/README.md:
--------------------------------------------------------------------------------
1 | # vue3
2 |
3 | ## Project setup
4 | ```
5 | yarn install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | yarn serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | yarn build
16 | ```
17 |
18 | ### Lints and fixes files
19 | ```
20 | yarn lint
21 | ```
22 |
23 | ### Customize configuration
24 | See [Configuration Reference](https://cli.vuejs.org/config/).
25 |
--------------------------------------------------------------------------------
/examples/vue3/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/examples/vue3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue3",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "core-js": "^3.6.5",
12 | "vue": "^3.0.0"
13 | },
14 | "devDependencies": {
15 | "@vue/cli-plugin-babel": "~4.5.0",
16 | "@vue/cli-plugin-eslint": "~4.5.0",
17 | "@vue/cli-service": "~4.5.0",
18 | "@vue/compiler-sfc": "^3.0.0",
19 | "babel-eslint": "^10.1.0",
20 | "eslint": "^6.7.2",
21 | "eslint-plugin-vue": "^7.0.0"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/examples/vue3/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yandex-maps-unofficial/vue-yandex-map/00724e276baf643e782d5b33d433f4782b5fcd5f/examples/vue3/public/favicon.ico
--------------------------------------------------------------------------------
/examples/vue3/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/vue3/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
21 |
22 |
27 |
--------------------------------------------------------------------------------
/examples/vue3/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import App from './App.vue'
3 | import ymapPlugin from '../../../dist/vue-yandex-maps.esm.js';
4 |
5 | const app = createApp(App)
6 |
7 | app.use(ymapPlugin)
8 | app.mount('#app')
9 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | moduleFileExtensions: [
3 | "js",
4 | "json",
5 | "vue"
6 | ],
7 | transform: {
8 | ".*\\.(vue)$": "vue-jest",
9 | "^.+\\.js$": "/node_modules/babel-jest"
10 | },
11 | moduleNameMapper: {
12 | "^@/(.*)$": "/src/$1"
13 | },
14 | globals: {
15 | MutationObserver: class {
16 | constructor(callback) {}
17 | disconnect() {}
18 | observe(element, initObject) {}
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/makefile:
--------------------------------------------------------------------------------
1 | cypress:
2 | gnome-terminal --tab -- sh -c "npm run serve --prefix examples/Cypress; bash"
3 | npx cypress open
4 |
5 | .PHONY: cypress
--------------------------------------------------------------------------------
/nuxt/index.js:
--------------------------------------------------------------------------------
1 | const { resolve } = require('path');
2 |
3 | module.exports = function nuxtVueYandexMaps(options) {
4 | this.addPlugin({
5 | src: resolve(__dirname, 'plugin.js'),
6 | fileName: 'vue-yandex-maps.js',
7 | options,
8 | ssr: false,
9 | });
10 | };
11 |
12 | module.exports.meta = require('../package.json');
13 |
--------------------------------------------------------------------------------
/nuxt/plugin.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import YmapPlugin from 'vue-yandex-maps';
3 |
4 | Vue.use(YmapPlugin, <%= serialize(options) %>);
5 |
--------------------------------------------------------------------------------
/old-docs.md:
--------------------------------------------------------------------------------
1 |
2 | # vue-yandex-maps
3 |
4 | vue-yandex-maps is a plugin for vue.js that adds yandex-map custom element.
5 |
6 | # Install
7 |
8 | ```Bash
9 | npm install vue-yandex-maps --save
10 | ```
11 |
12 | # Register component
13 |
14 | You may define config for map:
15 | * `apiKey: String` // '' by default [Documentation](https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/load-docpage/)
16 | * `lang: String` // 'ru_RU' by default [Available langs](https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/localization-docpage/)
17 | * `version: String` // '2.1' by default
18 |
19 | ```JavaScript
20 | const settings = { // you may define your apiKey, lang and version or skip this.
21 | apiKey: 'xxx',
22 | lang: 'ru_RU',
23 | version: '2.1'
24 | }
25 | ```
26 | ### Register globally
27 | ```JavaScript
28 | import YmapPlugin from 'vue-yandex-maps'
29 | Vue.use(YmapPlugin, settings)
30 | ```
31 | ### Or for a single instance
32 | ```JavaScript
33 | import { yandexMap, ymapMarker } from 'vue-yandex-maps'
34 | new Vue({
35 | components: { yandexMap, ymapMarker }
36 | })
37 |
38 | ```
39 | ```HTML
40 |
43 |
44 |
45 | ```
46 |
47 | ### Nuxt module
48 |
49 | Add `vue-yandex-maps/nuxt` to modules section of `nuxt.config.js`
50 |
51 | ```JavaScript
52 | {
53 | modules: [
54 | ['vue-yandex-maps/nuxt', settings]
55 | ]
56 | }
57 | ```
58 |
59 | ### Direct include
60 |
61 | You can use the CDN: https://unpkg.com/vue-yandex-maps, `yandexMap` is exposed to `window` and will automatically install itself. It might be useful for [Code Pen](https://codepen.io/PNKBizz/pen/WMRwyM)
62 |
63 | ## Usage
64 |
65 | Use `` tag to enable the map instance and use attributes to define map options.
66 |
67 | `` has a class `ymap-container` and child element, where rendering map instance. Child class you may define through map attribute `ymap-class`. If you doesn't define this class - child element will have `style` attribute with `width: 100%; height: 100%;`
68 |
69 | If you have a lot of markers on your map i strongly recommend you to use map attribute `useObjectManager`. But in this case you can't set callbacks to your markers through marker attribute `callbacks`.
70 |
71 | You may define placemarks on your map by using `` tag or set an array of objects with placemark options through `` attribute `placemarks` ([interface description](https://tech.yandex.ru/maps/doc/jsapi/2.0/ref/reference/GeoObject-docpage/)). You also can use both methods together.
72 | You must define `markerId` for every marker on your map in any case fo setting (through map attribute `placemarks` or using `ymap-marker` components).
73 | The Map instance rerender when changed array with markers or marker properties if marker is a component.
74 | Also map watch property `coords` and react without rerender, when it changed.
75 |
76 | Type of marker in `marker-type` attribute can be:
77 |
78 | * Placemark
79 | * Polyline
80 | * Rectangle
81 | * Polygon
82 | * Circle
83 |
84 | ```HTML
85 |
98 |
99 |
108 |
109 |
118 |
119 |
129 |
130 |
131 | ```
132 |
133 | ```JavaScript
134 |
135 | data() {
136 | return {
137 | placemarks: [
138 | {
139 | coords: [54.8, 39.8],
140 | properties: {}, // define properties here
141 | options: {}, // define options here
142 | clusterName: "1",
143 | balloonTemplate: '
"Your custom template"
'
144 | callbacks: { click: function() {} }
145 | }
146 | ]
147 | }
148 | }
149 |
150 | ```
151 |
152 | # Events
153 |
154 | ## Map events
155 |
156 | | Event name | Payload |
157 | | ----- | ----- |
158 | | 'click' | [map event](https://tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/events-docpage/) |
159 | | 'map-was-initialized' | Link to map instance |
160 |
161 | # Attributes
162 |
163 | ## Map attributes
164 |
165 | | Attribute | Type | Description |
166 | | ----- | ----- | ----- |
167 | | settings | Object | Map settings. You may define your apiKey, lang and version or skip this. |
168 | | coords | Array [ latitude, longtitude ] | Coordinates of map center. Required |
169 | | zoom | Number | Zoom of map (from 0 to 19). Default: `18`. |
170 | | cluster-options | Object | Map, where key is a name of cluster and value is an object of cluster options. Also you may set field 'layout' (type `String`) in cluster options object with HTML Template for balloonItemContentLayout. [Cluster option](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/ClusterPlacemark-docpage/#param-options) |
171 | | cluster-callbacks | Object | Map, where key is a name of cluster and value is an object, where key is an event name and value is a callback function, e.g. { click: function() {...}, contextmenu: anotherFunction } |
172 | | behaviors | Array | Array of enabled map behaviors. All another will be disabled. [Behaviors](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/map.behavior.Manager-docpage/#param-behaviors) |
173 | | controls | Array | Array of enabled map controls. All another will be disabled. [Controls](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.Manager-docpage/#add-param-control) |
174 | | detailed-controls | Object | Map, where key is a name of control and value is an object of control options. |
175 | | map-type | String | Map type. Possible types: `map, satellite, hybrid`. Default: `map`. |
176 | | scroll-zoom | Boolean | Set to `false` to disable zoom map on scroll page. Default: `true` |
177 | | zoom-control | Object | Configs for zoomControl of the map. [More](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.ZoomControl-docpage/) |
178 | | placemarks | Array of Objects | Array of config objects with fields: coordinates ([lat, lng]), properties, options. [More](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/Placemark-docpage/) |
179 | | use-object-manager | Boolean | Set to `true` to use Object Mananger in map. Default: `false` |
180 | | object-manager-clusterize | Boolean | Defines using clusterize in Object Mananger. Default: `true` |
181 | | ymap-class | String | Defines class for element, where rendering map instance. If not defined - element use style: `width: 100%; height: 100%;` |
182 | | init-without-markers | Boolean | Set to `false` to prevent map initialization if there is no markers. Default: `true` |
183 | | options | Object | [Map options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options) |
184 |
185 | ## Marker attributes
186 |
187 | | Attribute | Type | Description | Marker-types |
188 | | ----- | ----- | ----- | ----- |
189 | | marker-id | String, Number | Marker Id. `Required` ||
190 | | marker-type | String | Type of marker ||
191 | | coords | Array [ latitude, longtitude ] | Coordinates of point or circle center. `Required` | Placemark, Circle |
192 | | coords | Array of arrays [ [latitude, longtitude], [...] ] | Coordinates of shape corners. `Required` | Rectangle, Polyline |
193 | | coords | Array of two arrays of coordinates arrays (first for outer contour, second for inner) [ [[latitude, longtitude], [...]], [[...], [...]] ] | Coordinates of shape corners. Required | Polygon |
194 | | hint-content | String | Tooltip content | All |
195 | | balloon | Object | Balloon content object with three properties: header, body, footer | All |
196 | | icon | Object | [About icons](#icons) | Placemark |
197 | | marker-fill | Object | Fill properties object with four properties: enabled, color, opacity, imageHref | Polygon, Rectangle, Circle |
198 | | marker-stroke | Object | Stroke properties object with four properties: color, opacity, width, style | Polygon, Rectangle, Circle, Polyline |
199 | | circle-radius | Number | Radius of circle in meters. Default: `1000`. | Circle |
200 | | cluster-name | String | Attribute for grouping markers in clusters | All |
201 | | properties | Object | Object with marker [properties](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject-docpage/#param-feature.properties) | All |
202 | | options | Object | Object with marker [options](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject-docpage/#param-options) | All |
203 | | callbacks | Object | Object, where key is an event name and value is a callback function, e.g. { click: function() {...}, contextmenu: anotherFunction }. [Events list](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject-docpage/#events-summary) | All |
204 | | [balloonTemplate](#balloon-template) | String | HTML Template for balloon | All |
205 |
206 | # Icons
207 |
208 | You may define icon attribute as object with three properties: color (default value is 'blue'), content, glyph. Glyph property have higher priority than content. [List of colors and icons](https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage-docpage/). In this way you get classic placemark.
209 |
210 | Or you may define it as a placemark with custom icon. In this case you need to set the object of the following form:
211 |
212 | ```JavaScript
213 | {
214 | layout: 'default#image',
215 | imageHref: markerIcon,
216 | imageSize: [43, 55],
217 | imageOffset: [-22, -55]
218 | }
219 |
220 | ```
221 |
222 | If you need to use it with content, just change the layout as `default#imageWithContent`
223 |
224 | where `markerIcon`: data or computed path to image or data:image/svg+xml;base64, `imageSize`: size of icon in px, `imageOffset`: icon offset in px
225 |
226 | # Balloon Template
227 |
228 | You can define your own template for balloon.
229 |
230 | ```HTML
231 |
234 |
239 |
240 |
241 | ```
242 |
243 | ```JavaScript
244 | computed: {
245 | balloonTemplate() {
246 | return `
247 |