|
10 | 10 | > |
11 | 11 | <CdsBaseInput |
12 | 12 | :id="$attrs.id || id" |
13 | | - :key="baseInputControl" |
14 | 13 | ref="baseInput" |
15 | 14 | v-bind="{...$attrs, ...props}" |
16 | | - :model-value="get(localValue, optionsField)" |
| 15 | + v-model="computedModel" |
17 | 16 | type="text" |
18 | 17 | :onkeypress="`return ${allowSearch};`" |
19 | 18 | :placeholder="placeholder" |
@@ -98,7 +97,6 @@ import { get, cloneDeep } from 'lodash'; |
98 | 97 | import removeAccents from '../utils/methods/removeAccents'; |
99 | 98 | import CdsBaseInput from './BaseInput.vue'; |
100 | 99 |
|
101 | | -
|
102 | 100 | const model = defineModel('modelValue', { |
103 | 101 | type: [Array, Object], |
104 | 102 | }); |
@@ -296,7 +294,6 @@ const cdsSelect = useTemplateRef('cds-select'); |
296 | 294 | const selectOptions = useTemplateRef('select-options'); |
297 | 295 | const liRefs = ref({}); |
298 | 296 | const { emitClick, emitFocus, emitBlur, emitKeydown } = nativeEmits(emits); |
299 | | -const baseInputControl = ref(0); |
300 | 297 | const searchString = ref(''); |
301 | 298 |
|
302 | 299 | /* COMPUTED */ |
@@ -335,6 +332,7 @@ const showAddOption = computed(() => { |
335 | 332 | && !localOptions.value.some(option => option[props.optionsField]?.toLowerCase() === searchString?.value.toLowerCase()); |
336 | 333 | }); |
337 | 334 |
|
| 335 | +const computedModel = computed(() => localValue.value[props.optionsField]); |
338 | 336 |
|
339 | 337 | //NOTE: Essa computada vai ser removida junto com a descontinuação da prop width na V4 |
340 | 338 | const computedFluid = computed(() => { |
@@ -390,6 +388,7 @@ watch(localValue, (currentValue) => { |
390 | 388 |
|
391 | 389 | /* HOOKS */ |
392 | 390 | onMounted(() => { |
| 391 | + console.log('Select t2'); |
393 | 392 | id.value = `cds-select-${uniqueKey.value}`; |
394 | 393 | selectElement.value = cdsSelect.value; |
395 | 394 | }); |
@@ -441,7 +440,6 @@ function activateSelectionOnEnter() { |
441 | 440 | } |
442 | 441 |
|
443 | 442 | searchString.value = ''; |
444 | | - baseInputControl.value += 1; |
445 | 443 | select.value.blur(); |
446 | 444 | } |
447 | 445 |
|
@@ -472,7 +470,6 @@ function hide() { |
472 | 470 | nextTick(() => { |
473 | 471 | localOptions.value = pristineOptions.value; |
474 | 472 | searchString.value = ''; |
475 | | - baseInputControl.value += 1; |
476 | 473 | active.value = false; |
477 | 474 | }); |
478 | 475 |
|
|
0 commit comments