fix: Switch组件必须使用v-model而非:checked+@update:checked
This commit is contained in:
@@ -71,6 +71,13 @@ const fileSize = computed(() => {
|
||||
return null
|
||||
})
|
||||
|
||||
const isForcedUpdate = computed({
|
||||
get: () => formData.value.update_strategy === 'forced',
|
||||
set: (val: boolean) => {
|
||||
formData.value.update_strategy = val ? 'forced' : 'optional'
|
||||
},
|
||||
})
|
||||
|
||||
function formatFileSize(size: number): string {
|
||||
if (size < 1024)
|
||||
return `${size} B`
|
||||
@@ -413,9 +420,8 @@ onMounted(() => {
|
||||
</p>
|
||||
</div>
|
||||
<UiSwitch
|
||||
:checked="formData.update_strategy === 'forced'"
|
||||
v-model="isForcedUpdate"
|
||||
:disabled="saving"
|
||||
@update:checked="formData.update_strategy = $event ? 'forced' : 'optional'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -77,6 +77,13 @@ const fileSize = computed(() => {
|
||||
return null
|
||||
})
|
||||
|
||||
const isForcedUpdate = computed({
|
||||
get: () => formData.value.update_strategy === 'forced',
|
||||
set: (val: boolean) => {
|
||||
formData.value.update_strategy = val ? 'forced' : 'optional'
|
||||
},
|
||||
})
|
||||
|
||||
function formatFileSize(size: number): string {
|
||||
if (size < 1024)
|
||||
return `${size} B`
|
||||
@@ -430,9 +437,8 @@ watch(() => formData.value.application_id, (newAppId) => {
|
||||
</p>
|
||||
</div>
|
||||
<UiSwitch
|
||||
:checked="formData.update_strategy === 'forced'"
|
||||
v-model="isForcedUpdate"
|
||||
:disabled="saving"
|
||||
@update:checked="formData.update_strategy = $event ? 'forced' : 'optional'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user