0.0.4 • Published 5 years ago
vue-mapkit v0.0.4
vue-mapkit
A Vue library for Apple Mapkit. Inspired by thomas-alrek/MapkitVue.
Plugin doesn't contain any component wrappers. You should use mapkit directly.
Installation
# Yarn
yarn add vue-mapkit
# or NPM
npm install vue-mapkit --save
Usage
Initialization
Please follow the official MapkitJS documentation to setup your API credentials.
import Vue from 'vue'
import VueMapkit from 'vue-mapkit'
Vue.use(VueMapkit, {
authorizationCallback(done) {
// provide mapkit jwt here
done(process.env.VUE_APP_MAPKIT_JWT)
},
// you can use options from mapkit documentation as well
language: 'ja',
})
Draw a map
Now you can draw a map in a component.
import { createMapkit } from 'vue-mapkit'
export default {
computed: {
map_id() {
return `map-${this._uid}`
},
},
mounted() {
createMapkit(this.map_id, { language: 'ja' }).then(map => {
// use `map` to perform any changes
})
}
}
}