Mercurial > gemma
changeset 2989:87d34efafb3a
client: added uuid mixin to display multiple instances of the same component in splitview
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Wed, 10 Apr 2019 11:03:15 +0200 |
parents | e1ccc8438529 |
children | dfeb2928232b |
files | client/src/components/Maplayer.vue client/src/lib/mixins.js |
diffstat | 2 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue Wed Apr 10 11:00:23 2019 +0200 +++ b/client/src/components/Maplayer.vue Wed Apr 10 11:03:15 2019 +0200 @@ -40,17 +40,18 @@ */ import { HTTP } from "@/lib/http"; import { mapState } from "vuex"; -import uuid from "uuid"; import { Map, View } from "ol"; import { WFS, GeoJSON } from "ol/format"; import { equalTo } from "ol/format/filter"; import { Stroke, Style, Fill } from "ol/style"; import { displayError } from "@/lib/errors"; +import { uuid } from "@/lib/mixins"; import "ol/ol.css"; /* for the sake of debugging */ /* eslint-disable no-console */ export default { + mixins: [uuid], data() { return { splitscreen: false @@ -69,9 +70,6 @@ ...mapState("bottlenecks", ["selectedSurvey"]), ...mapState("application", ["showSplitscreen"]), ...mapState("imports", ["selectedStretchId"]), - uuid() { - return uuid.v4(); - }, hasActiveInteractions() { return ( (this.lineTool && this.lineTool.getActive()) ||
--- a/client/src/lib/mixins.js Wed Apr 10 11:00:23 2019 +0200 +++ b/client/src/lib/mixins.js Wed Apr 10 11:03:15 2019 +0200 @@ -12,6 +12,8 @@ * Markus Kottländer <markus.kottlaender@intevation.de> */ +import * as uuidGen from "uuid"; + const sortTable = { data() { return { @@ -29,4 +31,12 @@ } }; -export { sortTable }; +const uuid = { + computed: { + uuid() { + return uuidGen.v4(); + } + } +}; + +export { sortTable, uuid };