index.vue
1.92 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
<div class="icon-item-box" v-show="!isGroup">
<n-icon
class="go-ml-1 icon-item"
:class="{ active: status.lock }"
size="15"
:component="status.lock ? LockClosedOutlineIcon : LockOpenOutlineIcon"
@click="lockHandle"
/>
<n-icon
class="go-ml-1 icon-item"
:class="{ active: status.hide }"
size="15"
:component="status.hide ? EyeOffOutlineIcon : EyeOutlineIcon"
@click="showHandle"
/>
</div>
</template>
<script setup lang="ts">
import { computed, PropType } from 'vue'
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { StatusType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { icon } from '@/plugins'
const props = defineProps({
isGroup: {
type: Boolean,
default: false
},
hover: {
type: Boolean,
default: false
},
status: {
type: Object as PropType<StatusType>,
default: () => ({
lock: false,
hide: false
})
}
})
const { LockClosedOutlineIcon, LockOpenOutlineIcon, EyeOutlineIcon, EyeOffOutlineIcon } = icon.ionicons5
const chartEditStore = useChartEditStore()
const designStore = useDesignStore()
// 颜色
const themeColor = computed(() => {
return designStore.getAppTheme
})
// 隐藏 / 展示
const showHandle = (e: MouseEvent) => {
e.stopPropagation()
props.status.hide ? chartEditStore.setShow() : chartEditStore.setHide()
}
// 锁定 / 解锁
const lockHandle = (e: MouseEvent) => {
e.stopPropagation()
props.status.lock ? chartEditStore.setUnLock() : chartEditStore.setLock()
}
</script>
<style lang="scss" scoped>
$activeColor: v-bind('themeColor');
.icon-item-box {
white-space: nowrap;
.icon-item {
opacity: 0;
padding-top: 5px;
@extend.go-transition;
&.active,
&:hover {
color: $activeColor;
}
&.active {
opacity: 1 !important;
}
}
}
</style>