Skip to content

Commit

Permalink
Fix issue with unglobal install. Fix issue with map without markers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel_Galkin committed Aug 8, 2017
1 parent c0125f9 commit 57e6e10
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ You can use any build tool which supports `commonjs`:

```JavaScript
// register globally
var yandexMap = require('vue-yandex-maps');
var { yandexMap } = require('vue-yandex-maps');
Vue.use(yandexMap)

// or for a single instance
var yandexMap = require('vue-yandex-maps');
var { yandexMap, ymapMarker } = require('vue-yandex-maps');
new Vue({
components: {yandexMap}
components: { yandexMap, ymapMarker }
})

```
Expand All @@ -29,13 +29,13 @@ Or in ES2015:

```JavaScript
// register globally
import yandexMap from 'vue-yandex-maps'
import { yandexMap } from 'vue-yandex-maps'
Vue.use(yandexMap)

// or for a single instance
import yandexMap from 'vue-yandex-maps'
import { yandexMap, ymapMarker } from 'vue-yandex-maps'
new Vue({
components: {yandexMap}
components: { yandexMap, ymapMarker }
})

```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-yandex-maps",
"version": "0.1.2",
"version": "0.1.3",
"description": "Yandex Maps component for VueJS.",
"main": "vue-yandex-maps.js",
"jsnext:main": "./src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/YMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
zoom: +this.zoom
});
const myMarkers = this.$slots.default.map(marker => {
const myMarkers = this.$slots.default && this.$slots.default.map(marker => {
const props = marker.componentOptions && marker.componentOptions.propsData;
if (!props) return;
return {
Expand All @@ -89,7 +89,7 @@
markerFill: props.markerFill,
circleRadius: +props.circleRadius
}
}).filter(marker => marker && marker.markerType);
}).filter(marker => marker && marker.markerType) || [];
for (let i = 0; i < myMarkers.length; i++) {
const markerType = setFirstLetterToUppercase(myMarkers[i].markerType);
Expand Down
9 changes: 3 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ const install = function(Vue) {
});
};

if (window.Vue) {
window.YMapPlugin = YMapPlugin;
Vue.use(install); // eslint-disable-line
}

YMapPlugin.install = install;
export default YMapPlugin;

export const yandexMap = YMapPlugin;
export const ymapMarker = Marker;

0 comments on commit 57e6e10

Please sign in to comment.