Showing
1 changed file
with
8 additions
and
1 deletions
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | :disabled="disabled" |
| 10 | 10 | mode="multiple" |
| 11 | 11 | labelInValue |
| 12 | + :max-tag-count="selectDeviceMaxCount" | |
| 12 | 13 | /> |
| 13 | 14 | <template v-for="(item, index) in deviceList" :key="item.value"> |
| 14 | 15 | <SelectAttributes |
| ... | ... | @@ -25,6 +26,7 @@ |
| 25 | 26 | import SelectAttributes from './SelectAttributes.vue'; |
| 26 | 27 | import { TDeviceList, TSelectOption } from '../type'; |
| 27 | 28 | import { createPickerSearch } from '/@/utils/pickerSearch'; |
| 29 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
| 28 | 30 | |
| 29 | 31 | const props = defineProps({ |
| 30 | 32 | selectOptions: { |
| ... | ... | @@ -37,6 +39,8 @@ |
| 37 | 39 | }, |
| 38 | 40 | }); |
| 39 | 41 | |
| 42 | + const { createMessage } = useMessage(); | |
| 43 | + | |
| 40 | 44 | const selectValue = ref([]); |
| 41 | 45 | |
| 42 | 46 | const bindDeviceRef = { |
| ... | ... | @@ -52,7 +56,10 @@ |
| 52 | 56 | }; |
| 53 | 57 | |
| 54 | 58 | const handleDeviceChange = (_, options) => { |
| 55 | - if (options.length > selectDeviceMaxCount.value) return; | |
| 59 | + if (options.length > selectDeviceMaxCount.value) { | |
| 60 | + createMessage.warn(`限制选择设备数为${selectDeviceMaxCount.value}`); | |
| 61 | + return; | |
| 62 | + } | |
| 56 | 63 | deviceList.value = options; |
| 57 | 64 | }; |
| 58 | 65 | ... | ... |