This repository was archived by the owner on Feb 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
playground/src/pages/controls Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,15 +17,11 @@ const { toneMapping } = useControls({
1717 ],
1818 },
1919})
20-
21- const formattedToneMapping = computed (() => {
22- return Number (toneMapping .value )
23- })
2420 </script >
2521
2622<template >
2723 <TresLeches />
28- <TresCanvas clear-color="#82DBC5 " :tone-mapping =" formattedToneMapping " >
24+ <TresCanvas clear-color="#82DBC5 " :tone-mapping =" toneMapping " >
2925 <TresPerspectiveCamera :position =" [4 , 4 , 4 ] " />
3026 <Suspense >
3127 <Environment preset="sunset" :background =" true " />
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import type { LechesControl } from ' ../types'
2+ import type { LechesControl , LechesSelectOption } from ' ../types'
33import ControlLabel from ' ./ControlLabel.vue'
44
5- defineProps <{
5+ const props = defineProps <{
66 label: string
77 control: LechesControl
88}>()
99
1010const emit = defineEmits ([' change' ])
1111
1212function onChange(event : Event ) {
13- emit (' change' , (event .target as HTMLSelectElement ).value )
13+ const selectedValue = (event .target as HTMLSelectElement ).value
14+
15+ // Find the matching option to preserve the original type
16+ const selectedOption = props .control .options ?.find ((option : LechesSelectOption ) =>
17+ String (option .value ) === selectedValue ,
18+ )
19+
20+ // Use the original value with its correct type
21+ emit (' change' , selectedOption ?.value ?? selectedValue )
1422}
1523 </script >
1624
@@ -22,14 +30,14 @@ function onChange(event: Event) {
2230 />
2331 <select
2432 :id =" control.uniqueKey"
25- :value =" control.value"
33+ :value =" String( control.value) "
2634 class =" tl-leches-input tl-w-2/3"
2735 @change =" onChange"
2836 >
2937 <option
3038 v-for =" option in control.options"
31- :key =" option.value"
32- :value =" option.value"
39+ :key =" String( option.value) "
40+ :value =" String( option.value) "
3341 >
3442 {{ option.text }}
3543 </option >
You can’t perform that action at this time.
0 commit comments