-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
033f34d
commit 9bf4416
Showing
8 changed files
with
358 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<template> | ||
<l-map | ||
ref="leafletMap" | ||
style="height: 300px" | ||
:zoom="zoom" | ||
:center="center" | ||
:options="options" | ||
> | ||
<l-tile-layer | ||
v-for="tileProvider in tileProviders" | ||
:key="tileProvider.name" | ||
:name="tileProvider.name" | ||
:visible="tileProvider.visible" | ||
:url="tileProvider.url" | ||
:attribution="tileProvider.attribution" | ||
layer-type="base" | ||
/> | ||
<l-control-layers position="bottomright"></l-control-layers> | ||
<l-control-zoom position="topright"></l-control-zoom> | ||
<l-control position="topright" class="custom-control"> | ||
<p @click="centerMap">Go Back</p> | ||
</l-control> | ||
<l-marker :lat-lng="markerLatLng" :icon="icon"> | ||
<l-tooltip | ||
:options="{ | ||
offset: [-4, 20], | ||
direction: 'bottom', | ||
}" | ||
>中央研究院 人文社會科學館</l-tooltip | ||
></l-marker | ||
> | ||
</l-map> | ||
</template> | ||
|
||
<script> | ||
import { | ||
LMap, | ||
LControl, | ||
LTileLayer, | ||
LMarker, | ||
LControlZoom, | ||
LControlLayers, | ||
LTooltip, | ||
} from 'vue2-leaflet' | ||
import { icon } from 'leaflet' | ||
export default { | ||
name: 'VenueMap', | ||
components: { | ||
LMap, | ||
LTileLayer, | ||
LMarker, | ||
LControlZoom, | ||
LControlLayers, | ||
LTooltip, | ||
LControl, | ||
}, | ||
data() { | ||
return { | ||
communityImgUrl: {}, | ||
options: { | ||
zoomControl: false, | ||
scrollWheelZoom: false, | ||
}, | ||
tileProviders: [ | ||
{ | ||
name: 'Stamen', | ||
visible: false, | ||
attribution: | ||
'Tiles by <a href="https://stamen.com">Stamen Design</a>. Data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors.', | ||
url: 'http://{s}.sm.mapstack.stamen.com/((toner-background,$fff[@20],$000[hsl-color])[@90],(toner-lines,$fff[@80],$fff[hsl-saturation@20],$502526[hsl-color]),(toner-labels,$fff[@30]))/{z}/{x}/{y}.png', | ||
}, | ||
{ | ||
name: 'Transport', | ||
visible: true, | ||
attribution: | ||
'Maps © <a href="https://www.thunderforest.com" target="_blank" rel="noopener">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap </a> contributors.', | ||
url: 'https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=6170aad10dfd42a38d4d8c709a536f38', | ||
}, | ||
], | ||
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
attribution: | ||
'© <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors', | ||
zoom: 15, | ||
icon: icon({ | ||
iconUrl: '/snake-icon.png', | ||
iconSize: [41, 42], | ||
iconAnchor: [33, 15], | ||
}), | ||
center: [25.040997, 121.611417], | ||
markerLatLng: [25.040997, 121.611417], | ||
} | ||
}, | ||
methods: { | ||
centerMap() { | ||
this.$nextTick(() => { | ||
this.$refs.leafletMap.mapObject.panTo([25.040997, 121.611417]) | ||
}) | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.custom-control { | ||
cursor: pointer; | ||
background: #fff; | ||
padding: 0 0.5em; | ||
border: 1px solid #aaa; | ||
border-radius: 0.1em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Vue from 'vue' | ||
import { LMap, LTileLayer, LMarker } from 'vue2-leaflet' | ||
import 'leaflet/dist/leaflet.css' | ||
|
||
Vue.component('l-map', LMap) | ||
Vue.component('l-tile-layer', LTileLayer) | ||
Vue.component('l-marker', LMarker) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.