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,9 +41,9 @@ | ||
41 | > | 41 | > |
42 | <label class="switch"> | 42 | <label class="switch"> |
43 | <input | 43 | <input |
44 | - :value="props.value?.value" | 44 | + :value="!!props.value?.value" |
45 | type="checkbox" | 45 | type="checkbox" |
46 | - :checked="props.value?.value" | 46 | + :checked="!!props.value?.value" |
47 | @change="handleChange" | 47 | @change="handleChange" |
48 | /> | 48 | /> |
49 | <div class="button"> | 49 | <div class="button"> |
@@ -8,6 +8,7 @@ import { isString } from '/@/utils/is'; | @@ -8,6 +8,7 @@ import { isString } from '/@/utils/is'; | ||
8 | const { createMessage } = useMessage(); | 8 | const { createMessage } = useMessage(); |
9 | export function useSendCommand() { | 9 | export function useSendCommand() { |
10 | const sendCommand = async (record: ControlComponentValue, value: any) => { | 10 | const sendCommand = async (record: ControlComponentValue, value: any) => { |
11 | + if (!record) return; | ||
11 | const { deviceId, deviceProfileId, attribute } = record; | 12 | const { deviceId, deviceProfileId, attribute } = record; |
12 | if (!deviceId) return; | 13 | if (!deviceId) return; |
13 | try { | 14 | try { |