# HG changeset patch # User Markus Kottlaender # Date 1554886995 -7200 # Node ID 87d34efafb3adeb18a63b1d4698036f4c4e4350a # Parent e1ccc843852935b26c5fff8b2cdca86af983cd60 client: added uuid mixin to display multiple instances of the same component in splitview diff -r e1ccc8438529 -r 87d34efafb3a client/src/components/Maplayer.vue --- 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()) || diff -r e1ccc8438529 -r 87d34efafb3a client/src/lib/mixins.js --- 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 */ +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 };