Null select style v0.12
by Vladimir Vershinin
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.4.3/build/ol.js"></script>
<script src="https://unpkg.com/[email protected]/dist/vuelayers.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vuelayers.css">
<div id="app">
{{ selectedFeatures }}
<vl-map ref="map" data-projection="EPSG:4326">
<vl-view ref="view" :zoom.sync="zoom" :center.sync="center"></vl-view>
<vl-layer-tile>
<vl-source-osm></vl-source-osm>
</vl-layer-tile>
<vl-layer-vector>
<vl-source-vector>
<vl-feature>
<vl-geom-point :coordinates="[10, 10]"></vl-geom-point>
<vl-style>
<vl-style-icon src="https://www.iconfinder.com/data/icons/small-n-flat/24/678111-map-marker-512.png" :scale="0.1" :anchor="[0.5, 1]"></vl-style-icon>
</vl-style>
</vl-feature>
</vl-source-vector>
</vl-layer-vector>
<vl-interaction-select :features.sync="selectedFeatures">
<template slot-scope="select">
<vl-overlay v-for="feature in select.features" :key="feature.id" :id="feature.id" :position="feature.geometry.coordinates" :auto-pan="true" :auto-pan-animation="{ duration: 300 }" positioning="bottom-center">
<div class="feature-popup">
<section class="card">
<header class="modal-header">
<span class="close-modal" @click="selectedFeatures = selectedFeatures.filter(f => f.id !== feature.id)">
<i class="fal fa-times"></i>
</span>
</header>
<div class="card-content">
<div class="content">
<h1>Test</h1>
</div>
</div>
</section>
</div>
</vl-overlay>
</template>
</vl-interaction-select>
</vl-map>
</div>
CSS
html, body, #app {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#app {
display: flex;
flex-direction: column;
}
.vl-map {
overflow: hidden;
}
JavaScript
new Vue({
el: '#app',
data() {
return {
zoom: 2,
center: [0, 0],
selectedFeatures: [],
}
},
})