@@ -29,7 +29,7 @@ import DrawDemo from "@demos/DrawDemo.vue"
2929 <ol-map
3030 :loadTilesWhileAnimating="true"
3131 :loadTilesWhileInteracting="true"
32- style="height:400px"
32+ style="height: 400px"
3333 >
3434 <ol-view
3535 ref="view"
@@ -51,51 +51,41 @@ import DrawDemo from "@demos/DrawDemo.vue"
5151 @drawend="drawend"
5252 @drawstart="drawstart"
5353 >
54+ <ol-style>
55+ <ol-style-stroke color="blue" :width="2"></ol-style-stroke>
56+ <ol-style-fill color="rgba(255, 255, 0, 0.4)"></ol-style-fill>
57+ </ol-style>
5458 </ol-interaction-draw>
5559 </ol-source-vector>
5660
5761 <ol-style>
5862 <ol-style-stroke color="red" :width="2"></ol-style-stroke>
5963 <ol-style-fill color="rgba(255,255,255,0.1)"></ol-style-fill>
6064 <ol-style-circle :radius="7">
61- <ol-style-fill color="blue "></ol-style-fill>
65+ <ol-style-fill color="red "></ol-style-fill>
6266 </ol-style-circle>
6367 </ol-style>
6468 </ol-vector-layer>
6569 </ol-map>
6670</template>
6771
68- <script>
69- import { ref, inject } from "vue";
70- export default {
71- setup() {
72- const center = ref([40, 40]);
73- const projection = ref("EPSG:4326");
74- const zoom = ref(8);
75- const rotation = ref(0);
76-
77- const drawEnable = ref(true);
78- const drawType = ref("Point");
79-
80- const drawstart = (event) => {
81- console.log(event);
82- };
83-
84- const drawend = (event) => {
85- console.log(event);
86- };
87-
88- return {
89- center,
90- projection,
91- zoom,
92- rotation,
93- drawEnable,
94- drawType,
95- drawstart,
96- drawend,
97- };
98- },
72+ <script setup>
73+ import { ref } from "vue";
74+
75+ const center = ref([40, 40]);
76+ const projection = ref("EPSG:4326");
77+ const zoom = ref(8);
78+ const rotation = ref(0);
79+
80+ const drawEnable = ref(true);
81+ const drawType = ref("Polygon");
82+
83+ const drawstart = (event) => {
84+ console.log(event);
85+ };
86+
87+ const drawend = (event) => {
88+ console.log(event);
9989};
10090</script>
10191```
0 commit comments