mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[v-autocomplete] Fix for special characters
This commit is contained in:
1 parent
2d7f29e9f4
commit
994356628d
10 files changed
+147
-83
No files matched your search
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
methods: {
|
||||
customFilter(item, input) {
|
||||
// Replace accented characters with non-accented equivalents
|
||||
const normalizedItem = item.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
||||
const normalizedInput = input.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
||||
|
||||
// Remove any character that is not a letter, number, or space from both the item and the input
|
||||
const pattern = /[^a-zA-Z0-9 ]/g;
|
||||
const cleanedItem = normalizedItem.replace(pattern, '');
|
||||
const cleanedInput = normalizedInput.replace(pattern, '');
|
||||
|
||||
// Check if the cleaned item starts with the cleaned input
|
||||
return cleanedItem.toLowerCase().startsWith(cleanedInput.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user