refactor: #7090 for InputChips
parent
46423fc8a0
commit
0bfe3ce507
|
@ -18,7 +18,7 @@
|
||||||
<li
|
<li
|
||||||
v-for="(val, i) of modelValue"
|
v-for="(val, i) of modelValue"
|
||||||
:key="`${i}_${val}`"
|
:key="`${i}_${val}`"
|
||||||
:id="id + '_inputchips_item_' + i"
|
:id="$id + '_inputchips_item_' + i"
|
||||||
role="option"
|
role="option"
|
||||||
:class="cx('chipItem', { index: i })"
|
:class="cx('chipItem', { index: i })"
|
||||||
:aria-label="val"
|
:aria-label="val"
|
||||||
|
@ -60,7 +60,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { UniqueComponentId } from '@primevue/core/utils';
|
|
||||||
import Chip from 'primevue/chip';
|
import Chip from 'primevue/chip';
|
||||||
import BaseInputChips from './BaseInputChips.vue';
|
import BaseInputChips from './BaseInputChips.vue';
|
||||||
|
|
||||||
|
@ -71,20 +70,13 @@ export default {
|
||||||
emits: ['update:modelValue', 'add', 'remove', 'focus', 'blur'],
|
emits: ['update:modelValue', 'add', 'remove', 'focus', 'blur'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
id: this.$attrs.id,
|
|
||||||
inputValue: null,
|
inputValue: null,
|
||||||
focused: false,
|
focused: false,
|
||||||
focusedIndex: null
|
focusedIndex: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
'$attrs.id': function (newValue) {
|
|
||||||
this.id = newValue || UniqueComponentId();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
console.warn('Deprecated since v4. Use AutoComplete component instead with its typeahead property.');
|
console.warn('Deprecated since v4. Use AutoComplete component instead with its typeahead property.');
|
||||||
this.id = this.id || UniqueComponentId();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onWrapperClick() {
|
onWrapperClick() {
|
||||||
|
@ -261,7 +253,7 @@ export default {
|
||||||
return this.max && this.modelValue && this.max === this.modelValue.length;
|
return this.max && this.modelValue && this.max === this.modelValue.length;
|
||||||
},
|
},
|
||||||
focusedOptionId() {
|
focusedOptionId() {
|
||||||
return this.focusedIndex !== null ? `${this.id}_inputchips_item_${this.focusedIndex}` : null;
|
return this.focusedIndex !== null ? `${this.$id}_inputchips_item_${this.focusedIndex}` : null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
Loading…
Reference in New Issue