提交 | 用户 | 时间
|
820397
|
1 |
<script lang="ts" setup> |
H |
2 |
import { useAppStore } from '@/store/modules/app' |
|
3 |
import { useDesign } from '@/hooks/web/useDesign' |
|
4 |
|
|
5 |
defineOptions({ name: 'LayoutRadioPicker' }) |
|
6 |
|
|
7 |
const { getPrefixCls } = useDesign() |
|
8 |
|
|
9 |
const prefixCls = getPrefixCls('layout-radio-picker') |
|
10 |
|
|
11 |
const appStore = useAppStore() |
|
12 |
|
|
13 |
const layout = computed(() => appStore.getLayout) |
|
14 |
</script> |
|
15 |
|
|
16 |
<template> |
|
17 |
<div :class="prefixCls" class="flex flex-wrap space-x-14px"> |
|
18 |
<div |
|
19 |
:class="[ |
|
20 |
`${prefixCls}__classic`, |
|
21 |
'relative w-56px h-48px cursor-pointer bg-gray-300', |
|
22 |
{ |
|
23 |
'is-acitve': layout === 'classic' |
|
24 |
} |
|
25 |
]" |
|
26 |
@click="appStore.setLayout('classic')" |
|
27 |
></div> |
|
28 |
<div |
|
29 |
:class="[ |
|
30 |
`${prefixCls}__top-left`, |
|
31 |
'relative w-56px h-48px cursor-pointer bg-gray-300', |
|
32 |
{ |
|
33 |
'is-acitve': layout === 'topLeft' |
|
34 |
} |
|
35 |
]" |
|
36 |
@click="appStore.setLayout('topLeft')" |
|
37 |
></div> |
|
38 |
<div |
|
39 |
:class="[ |
|
40 |
`${prefixCls}__top`, |
|
41 |
'relative w-56px h-48px cursor-pointer bg-gray-300', |
|
42 |
{ |
|
43 |
'is-acitve': layout === 'top' |
|
44 |
} |
|
45 |
]" |
|
46 |
@click="appStore.setLayout('top')" |
|
47 |
></div> |
|
48 |
<div |
|
49 |
:class="[ |
|
50 |
`${prefixCls}__cut-menu`, |
|
51 |
'relative w-56px h-48px cursor-pointer bg-gray-300', |
|
52 |
{ |
|
53 |
'is-acitve': layout === 'cutMenu' |
|
54 |
} |
|
55 |
]" |
|
56 |
@click="appStore.setLayout('cutMenu')" |
|
57 |
> |
|
58 |
<div class="absolute left-[10%] top-0 h-full w-[33%] bg-gray-200"></div> |
|
59 |
</div> |
|
60 |
</div> |
|
61 |
</template> |
|
62 |
|
|
63 |
<style lang="scss" scoped> |
|
64 |
$prefix-cls: #{$namespace}-layout-radio-picker; |
|
65 |
|
|
66 |
.#{$prefix-cls} { |
|
67 |
&__classic { |
|
68 |
border: 2px solid #e5e7eb; |
|
69 |
border-radius: 4px; |
|
70 |
|
|
71 |
&::before { |
|
72 |
position: absolute; |
|
73 |
top: 0; |
|
74 |
left: 0; |
|
75 |
z-index: 1; |
|
76 |
width: 33%; |
|
77 |
height: 100%; |
|
78 |
background-color: #273352; |
|
79 |
border-radius: 4px 0 0 4px; |
|
80 |
content: ''; |
|
81 |
} |
|
82 |
|
|
83 |
&::after { |
|
84 |
position: absolute; |
|
85 |
top: 0; |
|
86 |
left: 0; |
|
87 |
width: 100%; |
|
88 |
height: 25%; |
|
89 |
background-color: #fff; |
|
90 |
border-radius: 4px 4px 0; |
|
91 |
content: ''; |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
&__top-left { |
|
96 |
border: 2px solid #e5e7eb; |
|
97 |
border-radius: 4px; |
|
98 |
|
|
99 |
&::before { |
|
100 |
position: absolute; |
|
101 |
top: 0; |
|
102 |
left: 0; |
|
103 |
z-index: 1; |
|
104 |
width: 100%; |
|
105 |
height: 33%; |
|
106 |
background-color: #273352; |
|
107 |
border-radius: 4px 4px 0 0; |
|
108 |
content: ''; |
|
109 |
} |
|
110 |
|
|
111 |
&::after { |
|
112 |
position: absolute; |
|
113 |
top: 0; |
|
114 |
left: 0; |
|
115 |
width: 33%; |
|
116 |
height: 100%; |
|
117 |
background-color: #fff; |
|
118 |
border-radius: 4px 0 0 4px; |
|
119 |
content: ''; |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
&__top { |
|
124 |
border: 2px solid #e5e7eb; |
|
125 |
border-radius: 4px; |
|
126 |
|
|
127 |
&::before { |
|
128 |
position: absolute; |
|
129 |
top: 0; |
|
130 |
left: 0; |
|
131 |
z-index: 1; |
|
132 |
width: 100%; |
|
133 |
height: 33%; |
|
134 |
background-color: #273352; |
|
135 |
border-radius: 4px 4px 0 0; |
|
136 |
content: ''; |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
&__cut-menu { |
|
141 |
border: 2px solid #e5e7eb; |
|
142 |
border-radius: 4px; |
|
143 |
|
|
144 |
&::before { |
|
145 |
position: absolute; |
|
146 |
top: 0; |
|
147 |
left: 0; |
|
148 |
z-index: 1; |
|
149 |
width: 100%; |
|
150 |
height: 33%; |
|
151 |
background-color: #273352; |
|
152 |
border-radius: 4px 4px 0 0; |
|
153 |
content: ''; |
|
154 |
} |
|
155 |
|
|
156 |
&::after { |
|
157 |
position: absolute; |
|
158 |
top: 0; |
|
159 |
left: 0; |
|
160 |
width: 10%; |
|
161 |
height: 100%; |
|
162 |
background-color: #fff; |
|
163 |
border-radius: 4px 0 0 4px; |
|
164 |
content: ''; |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
.is-acitve { |
|
169 |
border-color: var(--el-color-primary); |
|
170 |
} |
|
171 |
} |
|
172 |
</style> |