From 289ee826454edee49166e1c2b21c9b054a02aeb1 Mon Sep 17 00:00:00 2001 From: Eduardo Peredo Date: Sun, 1 Apr 2018 11:52:58 -0500 Subject: [PATCH] fix(docs): update docs to match latest version --- README.md | 232 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 122 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index a657d9a..208bb7b 100644 --- a/README.md +++ b/README.md @@ -8,127 +8,139 @@ ## Demo -- [JSBin example](http://jsbin.com/gizixekilu/edit?html,js,output) +* [JSBin example](http://jsbin.com/gizixekilu/edit?html,js,output) ## Requirements -1. Vue 2.X.X -2. vue-cli https://github.com/vuejs/vue-cli (for development only) +1. Vue 2.X.X ## Usage -1. Install from npm - - npm install vue-static-map - - Or include in your html using the script tag - ```html - - ``` - -2. Add component in your app - - ```javascript - import StaticMap from 'vue-static-map'; - // or require('vue-static-map') - // or window.StaticMap if you are including in a script tag - - export default { - components: { - StaticMap, - }, - } - - ``` - -3. Create some parameters in your data object - - ```javascript - export default { - data: { - apiKey: 'YOUR_GOOGLE_API_KEY', // required - zoom: 13, // required - center: 'Brooklyn+Bridge,New+York,NY', - format: 'gif', - language: 'ja', - markers: [ - { - label: 'B', color: 'blue', lat: 40.702147, lng: -74.015794, size: 'normal', - }, - { - label: 'Y', color: 'yellow', lat: 40.711614, lng: -74.012318, size: 'tiny', - }, - { - label: 'G', color: 'green', lat: 40.718217, lng: -74.015794, size: 'small', icon: 'http://www.airsoftmap.net/images/pin_map.png', - }, - ], - paths: [ - { - color: 'blue', - weight: 8, - geodesic: false, - fillcolor: '0xFFFF0033', - locations: [ - { startLat: 40.737102, endLng: -73.990318 }, - { startLat: 40.749825, endLng: -73.987963 }, - { startLat: 40.752946, endLng: -73.987384 }, - { startLat: 40.762946, endLng: -73.997399 }, - ], - }, - ], - type: 'roadmap', - size: [800, 400], - }, - components: { - StaticMap, - }, - } - ``` - -4. In your template just call the static map component - - ```html - - ``` +1. Install from npm + + npm install vue-static-map + + Or include in your html using the script tag + + ```html + + ``` + +2. Add component in your app + + ```javascript + import StaticMap from 'vue-static-map'; + // or require('vue-static-map') + // or window.StaticMap if you are including in a script tag + + export default { + components: { + StaticMap, + }, + }; + ``` + +3. Create some parameters in your data object + + ```javascript + export default { + data: { + apiKey: 'YOUR_GOOGLE_API_KEY', // required + zoom: 13, // required + center: 'Brooklyn+Bridge,New+York,NY', + format: 'gif', + language: 'ja', + markers: [ + { + label: 'B', + color: 'blue', + lat: 40.702147, + lng: -74.015794, + size: 'normal', + }, + { + label: 'Y', + color: 'yellow', + lat: 40.711614, + lng: -74.012318, + size: 'tiny', + }, + { + label: 'G', + color: 'green', + lat: 40.718217, + lng: -74.015794, + size: 'small', + icon: 'http://www.airsoftmap.net/images/pin_map.png', + }, + ], + paths: [ + { + color: 'blue', + weight: 8, + geodesic: false, + fillcolor: '0xFFFF0033', + locations: [ + { startLat: 40.737102, endLng: -73.990318 }, + { startLat: 40.749825, endLng: -73.987963 }, + { startLat: 40.752946, endLng: -73.987384 }, + { startLat: 40.762946, endLng: -73.997399 }, + ], + }, + ], + type: 'roadmap', + size: [800, 400], + }, + components: { + StaticMap, + }, + }; + ``` + +4. In your template just call the static map component + + ```html + + ``` ## Events -1. What about if you want the URL of the map, you can easily do that using the **getUrl** event - - ```javascript - function getUrl(url) { - this.url = url; - } - - export default { - data: () => { - const dataValues = { - apiKey: 'YOUR_API_KEY', - center: 'Empire State Building', - url: '', - zoom: 13, - }; - return dataValues; - }, - name: 'app', - components: { - StaticMap, - }, - methods: { - getUrl, - }, - }; - ``` - -2. Add the event on your template - - ```html - - ``` +1. What about if you want the URL of the map, you can easily do that using the **getUrl** event + + ```javascript + function getUrl(url) { + this.url = url; + } + + export default { + data: () => { + const dataValues = { + apiKey: 'YOUR_API_KEY', + center: 'Empire State Building', + url: '', + zoom: 13, + }; + return dataValues; + }, + name: 'app', + components: { + StaticMap, + }, + methods: { + getUrl, + }, + }; + ``` + +2. Add the event on your template + + ```html + + ``` ## Build Setup -``` bash +```bash # install dependencies npm install @@ -136,5 +148,5 @@ npm install npm run dev # build for production with minification -vue build src/components/StaticMap.vue --prod --lib +npm run component ```