From 8d16af662834f791581050940517aab11e192e6c Mon Sep 17 00:00:00 2001 From: Simon Boivin Date: Tue, 12 Dec 2023 12:29:07 -0500 Subject: [PATCH] add reactive prop to geojson layer --- docs/api/Layers/geojsonlayer.md | 6 ++++++ package.json | 2 +- src/components/layer/GeojsonLayer.js | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/api/Layers/geojsonlayer.md b/docs/api/Layers/geojsonlayer.md index 559f1dd..7708bdc 100644 --- a/docs/api/Layers/geojsonlayer.md +++ b/docs/api/Layers/geojsonlayer.md @@ -4,6 +4,12 @@ All common [layers props](/api/Layers/README.md#props) +### `reactive` + +- **Type:** `Boolean` +- **Default:** `true` +- **Description:** If false, no watcher on the source.data. you would need to manually update (ex: map.getSource('sourID').setData(newData)) + ### `source` - **Type:** `Object | String` diff --git a/package.json b/package.json index 0b100ab..8e080f7 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-mapbox3", - "version": "0.6.1", + "version": "0.6.2", "author": { "name": "simon boivin", "email": "sboivin@systra.com", diff --git a/src/components/layer/GeojsonLayer.js b/src/components/layer/GeojsonLayer.js index ee3b679..7c2ff7f 100644 --- a/src/components/layer/GeojsonLayer.js +++ b/src/components/layer/GeojsonLayer.js @@ -4,6 +4,12 @@ import mixin from "./layerMixin"; export default { name: "GeojsonLayer", mixins: [mixin], + props: { + reactive: { + type: Boolean, + default: true + } + }, computed: { getSourceFeatures() { @@ -87,7 +93,7 @@ export default { }, created() { - if (this.source) { + if (this.source && this.reactive) { this.$watch( "source.data", function(next) {