1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

refactor: filter functions as composable

This commit is contained in:
2022-08-03 11:10:16 +02:00
parent 35c54aee84
commit aaff4cf4fe
11 changed files with 72 additions and 60 deletions

View File

@ -4,7 +4,7 @@
<i class="mdi mdi-folder-open mr-1" />{{ message }}
</span>
<span class="text-ellipsis file-uploader-value">
{{ lastPart(modelValue) }}
{{ lastPart(modelValue, 19) }}
</span>
<i
v-if="modelValue"
@ -24,6 +24,9 @@
<script setup lang="ts">
import { uidGen } from 'common/libs/uidGen';
import { useFilters } from '@/composables/useFilters';
const { lastPart } = useFilters();
defineProps({
message: {
@ -43,15 +46,6 @@ const id = uidGen();
const clear = () => {
emit('clear');
};
const lastPart = (string: string) => {
if (!string) return '';
string = string.split(/[/\\]+/).pop();
if (string.length >= 19)
string = `...${string.slice(-19)}`;
return string;
};
</script>
<style lang="scss" scoped>