-
Notifications
You must be signed in to change notification settings - Fork 706
Expand file tree
/
Copy pathPreviewDashboard.vue
More file actions
53 lines (49 loc) · 1.03 KB
/
PreviewDashboard.vue
File metadata and controls
53 lines (49 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<script setup lang="ts">
import DsCanvasCore from '@/views/dashboard/canvas/DsCanvasCore.vue'
import { nextTick, onMounted, ref } from 'vue'
const cyGridster = ref(null)
const baseWidth = ref(0)
const baseHeight = ref(0)
const baseMarginLeft = ref(0)
const baseMarginTop = ref(0)
const componentData = [
{
id: 4,
x: 1,
y: 1,
sizex: 2,
sizey: 2
},
{
id: 10,
x: 2,
y: 1,
sizex: 2,
sizey: 2
},
{
id: 7,
x: 1,
y: 2,
sizex: 2,
sizey: 3
}
]
onMounted(() => {
const screenWidth = window.innerWidth
const screenHeight = window.innerHeight
baseWidth.value = 90.8333 * (screenWidth / 1366)
baseHeight.value = 100 * (screenHeight / 638)
baseMarginLeft.value = 20 * (screenWidth / 1366)
baseMarginTop.value = 20 * (screenHeight / 638)
nextTick(() => {
if (cyGridster.value) {
cyGridster.value.init()
}
})
})
</script>
<template>
<DsCanvasCore ref="cyGridster" :canvas-component-data="componentData"></DsCanvasCore>
</template>
<style scoped lang="less"></style>