Commit 5e373602cccf29ce4e054ec0816db9c0be2e2fc6
1 parent
17c070d3
fix: data component string 0 && 1 to bool is true
Showing
2 changed files
with
3 additions
and
2 deletions
| ... | ... | @@ -41,9 +41,9 @@ |
| 41 | 41 | > |
| 42 | 42 | <label class="switch"> |
| 43 | 43 | <input |
| 44 | - :value="props.value?.value" | |
| 44 | + :value="!!props.value?.value" | |
| 45 | 45 | type="checkbox" |
| 46 | - :checked="props.value?.value" | |
| 46 | + :checked="!!props.value?.value" | |
| 47 | 47 | @change="handleChange" |
| 48 | 48 | /> |
| 49 | 49 | <div class="button"> | ... | ... |
| ... | ... | @@ -8,6 +8,7 @@ import { isString } from '/@/utils/is'; |
| 8 | 8 | const { createMessage } = useMessage(); |
| 9 | 9 | export function useSendCommand() { |
| 10 | 10 | const sendCommand = async (record: ControlComponentValue, value: any) => { |
| 11 | + if (!record) return; | |
| 11 | 12 | const { deviceId, deviceProfileId, attribute } = record; |
| 12 | 13 | if (!deviceId) return; |
| 13 | 14 | try { | ... | ... |