Skip to content

Commit

Permalink
Merge pull request #107 from Pinegin/nuxtModule
Browse files Browse the repository at this point in the history
Добавлен возможность подключения плагина в nuxt module
  • Loading branch information
PNKBizz authored Jan 14, 2019
2 parents 28206f0 + 34409bc commit 34c14ea
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 34c14ea

Please sign in to comment.