feat: add clear button
This commit is contained in:
parent
5a27d424cc
commit
7400f9f611
3 changed files with 31 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import AppBox from './app/AppBox.vue';
|
import AppBox from './app/AppBox.vue';
|
||||||
import { CancelButton, SaveButton } from './button';
|
import { CancelButton, ClearButton, SaveButton } from './button';
|
||||||
|
|
||||||
defineExpose({ browse });
|
defineExpose({ browse });
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
|
@ -131,20 +131,15 @@ async function downloadImage(url: string) {
|
||||||
class="row items-center justify-end q-py-sm q-px-md bordered-t"
|
class="row items-center justify-end q-py-sm q-px-md bordered-t"
|
||||||
v-if="!hiddenFooter"
|
v-if="!hiddenFooter"
|
||||||
>
|
>
|
||||||
<q-btn
|
<ClearButton
|
||||||
dense
|
outlined
|
||||||
unelevated
|
|
||||||
flat
|
|
||||||
:color="$q.dark.isActive ? 'grey-9' : 'grey-4'"
|
|
||||||
:text-color="$q.dark.isActive ? 'grey-1' : 'grey-10'"
|
|
||||||
:label="$t('general.clear')"
|
|
||||||
@click="
|
@click="
|
||||||
inputFile && (inputFile.value = ''),
|
inputFile && (inputFile.value = ''),
|
||||||
(imageUrl = defaultUrl || fallbackUrl || ''),
|
(imageUrl = defaultUrl || fallbackUrl || ''),
|
||||||
(file = null)
|
(file = null)
|
||||||
"
|
"
|
||||||
class="q-px-md q-mr-auto"
|
class="q-px-md q-mr-auto"
|
||||||
:disable="
|
:disabled="
|
||||||
clearButtonDisabled ||
|
clearButtonDisabled ||
|
||||||
imageUrl === fallbackUrl ||
|
imageUrl === fallbackUrl ||
|
||||||
imageUrl === defaultUrl ||
|
imageUrl === defaultUrl ||
|
||||||
|
|
|
||||||
26
src/components/button/ClearButton.vue
Normal file
26
src/components/button/ClearButton.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import MainButton from './MainButton.vue';
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
(e: 'click', v: MouseEvent): void;
|
||||||
|
}>();
|
||||||
|
defineProps<{
|
||||||
|
iconOnly?: boolean;
|
||||||
|
solid?: boolean;
|
||||||
|
outlined?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
dark?: boolean;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<MainButton
|
||||||
|
@click="(e) => $emit('click', e)"
|
||||||
|
v-bind="{ ...$props, ...$attrs }"
|
||||||
|
icon="mdi-broom"
|
||||||
|
color="var(--gray-7-hsl)"
|
||||||
|
:title="iconOnly ? $t('general.clear') : undefined"
|
||||||
|
>
|
||||||
|
{{ $t('general.clear') }}
|
||||||
|
</MainButton>
|
||||||
|
</template>
|
||||||
|
|
@ -6,3 +6,4 @@ export { default as DeleteButton } from './DeleteButton.vue';
|
||||||
export { default as BackButton } from './BackButton.vue';
|
export { default as BackButton } from './BackButton.vue';
|
||||||
export { default as UndoButton } from './UndoButton.vue';
|
export { default as UndoButton } from './UndoButton.vue';
|
||||||
export { default as ToggleButton } from './ToggleButton.vue';
|
export { default as ToggleButton } from './ToggleButton.vue';
|
||||||
|
export { default as ClearButton } from './ClearButton.vue';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue