Skip to content

Commit

Permalink
Добавлен возможность подключения плагина в nuxt module
Browse files Browse the repository at this point in the history
  • Loading branch information
Антон Пинегин committed Jan 14, 2019
1 parent 37429f4 commit 34409bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ new Vue({

```

### Nuxt module

Add `vue-yandex-maps/nuxt` to modules section of `nuxt.config.js`

```JavaScript
{
modules: ['vue-yandex-maps/nuxt', options]
}
```

### Direct include

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)
Expand Down
12 changes: 12 additions & 0 deletions nuxt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const {resolve} = require('path');

module.exports = function nuxtVueYandexMaps(options) {
this.addPlugin({
src: resolve(__dirname, 'plugin.js'),
fileName: 'vue-yandex-maps.js',
options,
ssr: false
})
};

module.exports.meta = require('../package.json');
4 changes: 4 additions & 0 deletions nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import YmapPlugin from 'vue-yandex-maps';

Vue.use(YmapPlugin, <%= serialize(options) %>);

0 comments on commit 34409bc

Please sign in to comment.