Newer
Older
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
54
55
56
57
58
59
<script setup>
import DragGrid from "../../src/DragGrid.vue";
</script>
<template>
<drag-grid
v-model="someDisabledItems"
:cols="4"
:rows="4"
class="size"
:disabled-fields="disabledFields"
>
<template #item="{ rawItem }">
<div
class="container"
:style="{ background: rawItem.disabled ? 'red' : 'green' }"
></div>
</template>
<template #disabledField
><div class="container">This field is disabled!</div></template
>
</drag-grid>
</template>
<script>
export default {
name: "Example7DisabledItems",
data() {
return {
someDisabledItems: [
{ key: "key1", x: 1, y: 3, w: 1, h: 1, data: {} },
{ key: "key2", x: 2, y: 2, w: 1, h: 1, data: {} },
{ key: "key3", x: 3, y: 4, w: 1, h: 1, data: {} },
{ key: "key4", x: 3, y: 1, w: 1, h: 1, data: {}, disabled: true },
{ key: "key5", x: 1, y: 2, w: 1, h: 1, data: {}, disabled: true },
{ key: "key6", x: 4, y: 3, w: 1, h: 1, data: {}, disabled: true },
],
disabledFields: [
{ x: 1, y: 1 },
{ x: 2, y: 3 },
{ x: 4, y: 2 },
],
};
},
};
</script>
<style scoped>
.container {
background: lightcoral;
width: 100%;
height: 100%;
user-select: none;
text-align: center;
}
.size {
aspect-ratio: 1;
}
</style>