From 34409bc9706a2ae38d2c09a99c6a69875059594b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=9F=D0=B8=D0=BD=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D0=BD?= Date: Mon, 14 Jan 2019 16:05:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B2=20nuxt=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 10 ++++++++++ nuxt/index.js | 12 ++++++++++++ nuxt/plugin.js | 4 ++++ 3 files changed, 26 insertions(+) create mode 100644 nuxt/index.js create mode 100644 nuxt/plugin.js diff --git a/README.MD b/README.MD index 7bb05ba..e70237a 100755 --- a/README.MD +++ b/README.MD @@ -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) diff --git a/nuxt/index.js b/nuxt/index.js new file mode 100644 index 0000000..b2774df --- /dev/null +++ b/nuxt/index.js @@ -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'); diff --git a/nuxt/plugin.js b/nuxt/plugin.js new file mode 100644 index 0000000..69d36da --- /dev/null +++ b/nuxt/plugin.js @@ -0,0 +1,4 @@ +import Vue from 'vue'; +import YmapPlugin from 'vue-yandex-maps'; + +Vue.use(YmapPlugin, <%= serialize(options) %>);