vuetify
vuetify copied to clipboard
fix(VAutocomplete): selected text is wrong
Description
The PR fixes two bugs:
Bug: when using items objects the text shown when selecting an item was the item-value and not the item-title. Bug: when focusing VAutocomplete after having selected an item, the text value was set to item-value and not the item-title.
Motivation and Context
How Has This Been Tested?
Visually
Markup:
https://codepen.io/tibnor/pen/KKQqRGz
<template>
<v-autocomplete v-model="selectedKey" :items="items" item-title="name" item-value="key" />
<v-autocomplete v-model="selectedKey" :items="itemsRaw" />
</template>
<script>
export default {
name: 'Playground',
data: () => ({
selectedKey: 1,
items: [{ name: 'foo', key: 1 }, { name: 'bar', key: 2 }],
itemsRaw: [{ title: 'foo', value: 1 }, { title: 'bar', value: 2 }],
}),
}
</script>
Types of changes
- [x ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)
Checklist:
- [x ] The PR title is no longer than 64 characters.
- [x ] The PR is submitted to the correct branch (
masterfor bug fixes and documentation updates,devfor new features and backwards compatible changes andnextfor non-backwards compatible changes). - [x ] My code follows the code style of this project.
- [ x] I've added relevant changes to the documentation (applies to new features and breaking changes in core library)