Use uuid to produce unique id
This commit is contained in:
parent
054854480a
commit
71a9be2a13
|
@ -216,6 +216,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -245,10 +246,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'border-box-11',
|
||||
filterId: `border-box-11-filterId-${timestamp}`,
|
||||
filterId: `border-box-11-filterId-${id}`,
|
||||
|
||||
defaultColor: ['#8aaafb', '#1f33a2'],
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -113,10 +114,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = +new Date()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'border-box-12',
|
||||
filterId: `borderr-box-12-filterId-${timestamp}`,
|
||||
filterId: `borderr-box-12-filterId-${id}`,
|
||||
|
||||
defaultColor: ['#2e6099', '#7ce7fd'],
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = +new Date()
|
||||
return {
|
||||
ref: 'border-box-13',
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -92,12 +93,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'border-box-8',
|
||||
path: `border-box-8-path-${timestamp}`,
|
||||
gradient: `border-box-8-gradient-${timestamp}`,
|
||||
mask: `border-box-8-mask-${timestamp}`,
|
||||
path: `border-box-8-path-${id}`,
|
||||
gradient: `border-box-8-gradient-${id}`,
|
||||
mask: `border-box-8-mask-${id}`,
|
||||
|
||||
defaultColor: ['#235fa7', '#4fd2dd'],
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -144,12 +145,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'border-box-9',
|
||||
|
||||
gradientId: `border-box-9-gradient-${timestamp}`,
|
||||
maskId: `border-box-9-mask-${timestamp}`,
|
||||
gradientId: `border-box-9-gradient-${id}`,
|
||||
maskId: `border-box-9-mask-${id}`,
|
||||
|
||||
defaultColor: ['#11eefd', '#0078d2'],
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
import Charts from '@jiaminghi/charts'
|
||||
|
@ -19,10 +21,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: `charts-container-${timestamp}`,
|
||||
chartRef: `chart-${timestamp}`,
|
||||
ref: `charts-container-${id}`,
|
||||
chartRef: `chart-${id}`,
|
||||
|
||||
chart: null
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -162,17 +163,17 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'decoration-10',
|
||||
|
||||
animationId1: `d10ani1${timestamp}`,
|
||||
animationId2: `d10ani2${timestamp}`,
|
||||
animationId3: `d10ani3${timestamp}`,
|
||||
animationId4: `d10ani4${timestamp}`,
|
||||
animationId5: `d10ani5${timestamp}`,
|
||||
animationId6: `d10ani6${timestamp}`,
|
||||
animationId7: `d10ani7${timestamp}`,
|
||||
animationId1: `d10ani1${id}`,
|
||||
animationId2: `d10ani2${id}`,
|
||||
animationId3: `d10ani3${id}`,
|
||||
animationId4: `d10ani4${id}`,
|
||||
animationId5: `d10ani5${id}`,
|
||||
animationId6: `d10ani6${id}`,
|
||||
animationId7: `d10ani7${id}`,
|
||||
|
||||
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-11',
|
||||
|
||||
|
|
|
@ -83,23 +83,26 @@ export default {
|
|||
display: flex;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.normal {
|
||||
height: 0% !important;
|
||||
animation: ani-height 3s ease-in-out infinite;
|
||||
left: 50%;
|
||||
margin-left: -2px;
|
||||
}
|
||||
|
||||
.reverse {
|
||||
width: 0% !important;
|
||||
animation: ani-width 3s ease-in-out infinite;
|
||||
top: 50%;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
@keyframes ani-height {
|
||||
0% {
|
||||
height: 0%;
|
||||
}
|
||||
|
||||
70% {
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -110,6 +113,10 @@ export default {
|
|||
}
|
||||
|
||||
@keyframes ani-width {
|
||||
0% {
|
||||
width: 0%;
|
||||
}
|
||||
|
||||
70% {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -106,11 +107,11 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'decoration-9',
|
||||
|
||||
polygonId: `decoration-9-polygon-${timestamp}`,
|
||||
polygonId: `decoration-9-polygon-${id}`,
|
||||
|
||||
svgWH: [100, 100],
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -171,14 +171,14 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'dv-flyline-chart',
|
||||
unique: Math.random(),
|
||||
maskId: `flyline-mask-id-${timestamp}`,
|
||||
maskCircleId: `mask-circle-id-${timestamp}`,
|
||||
gradientId: `gradient-id-${timestamp}`,
|
||||
gradient2Id: `gradient2-id-${timestamp}`,
|
||||
maskId: `flyline-mask-id-${id}`,
|
||||
maskCircleId: `mask-circle-id-${id}`,
|
||||
gradientId: `gradient-id-${id}`,
|
||||
gradient2Id: `gradient2-id-${id}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -173,12 +173,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'dv-flyline-chart-enhanced',
|
||||
unique: Math.random(),
|
||||
flylineGradientId: `flyline-gradient-id-${timestamp}`,
|
||||
haloGradientId: `halo-gradient-id-${timestamp}`,
|
||||
flylineGradientId: `flyline-gradient-id-${id}`,
|
||||
haloGradientId: `halo-gradient-id-${id}`,
|
||||
/**
|
||||
* @description Type Declaration
|
||||
*
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -57,10 +59,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
gradientId1: `percent-pond-gradientId1-${timestamp}`,
|
||||
gradientId2: `percent-pond-gradientId2-${timestamp}`,
|
||||
gradientId1: `percent-pond-gradientId1-${id}`,
|
||||
gradientId2: `percent-pond-gradientId2-${id}`,
|
||||
|
||||
width: 0,
|
||||
height: 0,
|
||||
|
@ -234,10 +236,10 @@ export default {
|
|||
|
||||
await $nextTick()
|
||||
|
||||
const dom = $refs['percent-pond']
|
||||
const { clientWidth, clientHeight } = $refs['percent-pond']
|
||||
|
||||
this.width = dom.clientWidth
|
||||
this.height = dom.clientHeight
|
||||
this.width = clientWidth
|
||||
this.height = clientHeight
|
||||
},
|
||||
mergeConfig () {
|
||||
const { config, defaultConfig } = this
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -53,9 +55,9 @@ export default {
|
|||
default: () => ({})
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
const id = uuid()
|
||||
return {
|
||||
gradientId: `water-level-pond-${timestamp}`,
|
||||
gradientId: `water-level-pond-${id}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -37,3 +37,11 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||
|
||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||
}
|
||||
|
||||
export function uuid () {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
const r = Math.random() * 16 | 0
|
||||
const v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||
return v.toString(16)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue