Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fdq09eca committed Nov 16, 2023
1 parent c3c34f1 commit 791f4eb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions demo/src/components/ScaleBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
mapObject: Object,
},
data() {
return { ratio: "n/a" };
return { ratio: "n/a", scaleBar: null };
},
methods: {
Expand All @@ -29,6 +29,14 @@ export default {
mounted() {
const view = this.mapObject.view;
const scaleBar = new ScaleBar({
view: view,
unit: "dual",
container: this.$el.querySelector("#scale-widget"),
});
view.ui.add(this.$el, "bottom-left");
reactiveUtils
.whenOnce(() => view.ready)
.then(() => {
Expand All @@ -41,14 +49,6 @@ export default {
this.updateRatio(view);
}
);
const scaleBar = new ScaleBar({
view: view,
unit: "dual",
container: "scale-widget",
});
view.ui.add(this.$el, "bottom-left");
},
};
</script>
Expand Down

0 comments on commit 791f4eb

Please sign in to comment.