Skip to content

Commit a0baac8

Browse files
committed
refactor(ol-zoomslider-control): migrate to script setup
1 parent 639dffc commit a0baac8

File tree

3 files changed

+35
-36
lines changed

3 files changed

+35
-36
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template lang="">
2+
<div v-if="false"></div>
3+
</template>
4+
5+
<script setup>
6+
import useControl from "@/composables/useControl";
7+
import ZoomSlider from "ol/control/ZoomSlider";
8+
import { useAttrs } from "vue";
9+
10+
const props = defineProps({
11+
duration: {
12+
type: Number,
13+
default: 200,
14+
},
15+
className: {
16+
type: String,
17+
default: "ol-zoomslider",
18+
},
19+
render: {
20+
type: Function,
21+
},
22+
});
23+
24+
const attrs = useAttrs();
25+
const { control } = useControl(ZoomSlider, props, { attrs });
26+
27+
defineExpose({
28+
control,
29+
});
30+
</script>
31+
32+
<style lang=""></style>

src/components/mapControls/ZoomSliderControl.vue

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/components/mapControls/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import OlToggleControl from "./OlToggleControl.vue";
1515
import OlVideoRecorderControl from "./OlVideoRecorderControl.vue";
1616
import OlZoneControl from "./OlZoneControl.vue";
1717
import OlZoomControl from "./OlZoomControl.vue";
18-
import ZoomSliderControl from "./ZoomSliderControl.vue";
18+
import OlZoomSliderControl from "./OlZoomSliderControl.vue";
1919
import ZoomToExtentControl from "./ZoomToExtentControl.vue";
2020

2121
function install(app) {
@@ -31,7 +31,7 @@ function install(app) {
3131
app.component("ol-overviewmap-control", OlOverviewMapControl);
3232
app.component("ol-scaleline-control", OlScaleLineControl);
3333
app.component("ol-zoom-control", OlZoomControl);
34-
app.component(ZoomSliderControl.name, ZoomSliderControl);
34+
app.component("ol-zoomslider-control", OlZoomSliderControl);
3535
app.component(ZoomToExtentControl.name, ZoomToExtentControl);
3636
app.component("ol-rotate-control", OlRotateControl);
3737
app.component("ol-context-menu-control", OlContextMenuControl);
@@ -67,6 +67,6 @@ export {
6767
OlVideoRecorderControl,
6868
OlZoneControl,
6969
OlZoomControl,
70-
ZoomSliderControl,
70+
OlZoomSliderControl,
7171
ZoomToExtentControl,
7272
};

0 commit comments

Comments
 (0)