|
|
@@ -61,12 +61,12 @@ export default defineComponent({ |
|
|
|
const index = data.deviceList.findIndex((item) => item.deviceId === data.activeDeviceId) |
|
|
|
if (data.deviceList.length === 1) { |
|
|
|
return |
|
|
|
} else if (index === data.deviceList.length - 1) { |
|
|
|
data.activeDeviceId = data.deviceList[index - 1].deviceId |
|
|
|
} else if (index === 0) { |
|
|
|
data.activeDeviceId = data.deviceList[1].deviceId |
|
|
|
emit('update:value', data.activeDeviceId) |
|
|
|
emit('switch', { type: props.deviceType, deviceId: data.activeDeviceId }) |
|
|
|
} else { |
|
|
|
data.activeDeviceId = data.deviceList[index + 1].deviceId |
|
|
|
data.activeDeviceId = data.deviceList[0].deviceId |
|
|
|
emit('update:value', data.activeDeviceId) |
|
|
|
emit('switch', { type: props.deviceType, deviceId: data.activeDeviceId }) |
|
|
|
} |