Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 47fab29

Browse files
committed
feat: replace NSwitch with NCheckbox for WebGL flag in ImageDetailSection
- Updated the useWebglFlag to utilize useStorage for persistent state. - Changed the UI component from NSwitch to NCheckbox for better user interaction. - Adjusted layout and styling for the checkbox in the image detail section. Signed-off-by: Innei <tukon479@gmail.com>
1 parent e5f23e5 commit 47fab29

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/components/drawer/components/image-detail-section.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { uniqBy } from 'es-toolkit/compat'
33
import {
44
NButton,
55
NButtonGroup,
6+
NCheckbox,
67
NCollapse,
78
NCollapseItem,
89
NColorPicker,
@@ -44,7 +45,7 @@ export const ImageDetailSection = defineComponent({
4445
setup(props) {
4546
const loading = ref(false)
4647

47-
const useWebglFlag = ref(false)
48+
const useWebglFlag = useStorage('useWebglFlag', false)
4849

4950
const originImageMap = computed(() => {
5051
const map = new Map<string, ImageModel>()
@@ -185,15 +186,15 @@ export const ImageDetailSection = defineComponent({
185186
自动修正
186187
</NButton>
187188
</div>
188-
<div class="mt-2 flex">
189-
<NSwitch
190-
value={useWebglFlag.value}
191-
onUpdateValue={(e) => void (useWebglFlag.value = e)}
189+
<div class="mt-2 flex items-center gap-1 pl-1 text-sm">
190+
<NCheckbox
191+
size="small"
192+
checked={useWebglFlag.value}
193+
onUpdateChecked={(e) => void (useWebglFlag.value = e)}
192194
/>
193-
<div class="ml-2">
194-
{' '}
195+
<label for="useWebglFlag" class="ml-2">
195196
使用 Webgl 加速图片处理(实验性,调用 GPU 计算)
196-
</div>
197+
</label>
197198
</div>
198199
<NCollapse accordion class="mt-4">
199200
{images.value.map((image: ImageModel, index: number) => {

0 commit comments

Comments
 (0)