style: code style
parent
eb5710b880
commit
e5f33cd12b
|
@ -6,7 +6,7 @@ import type { CSSProperties, PropType } from 'vue';
|
||||||
import { computed, ref, unref, watch, watchEffect } from 'vue';
|
import { computed, ref, unref, watch, watchEffect } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { $t as t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ watch(
|
||||||
function handleUploadSuccess({ data, source }: any) {
|
function handleUploadSuccess({ data, source }: any) {
|
||||||
sourceValue.value = source;
|
sourceValue.value = source;
|
||||||
emit('change', { data, source });
|
emit('change', { data, source });
|
||||||
message.success(t('ui.cropper.uploadSuccess'));
|
message.success($t('ui.cropper.uploadSuccess'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const closeModal = () => modalApi.close();
|
const closeModal = () => modalApi.close();
|
||||||
|
@ -111,7 +111,7 @@ defineExpose({
|
||||||
@click="openModal"
|
@click="openModal"
|
||||||
v-bind="btnProps"
|
v-bind="btnProps"
|
||||||
>
|
>
|
||||||
{{ btnText ? btnText : t('ui.cropper.selectImage') }}
|
{{ btnText ? btnText : $t('ui.cropper.selectImage') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<CropperModal
|
<CropperModal
|
||||||
|
|
|
@ -6,7 +6,7 @@ import type { CropendResult, Cropper } from './typing';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { $t as t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { dataURLtoBlob, isFunction } from '@vben/utils';
|
import { dataURLtoBlob, isFunction } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -65,7 +65,7 @@ function modalLoading(loading: boolean) {
|
||||||
// Block upload
|
// Block upload
|
||||||
function handleBeforeUpload(file: File) {
|
function handleBeforeUpload(file: File) {
|
||||||
if (props.size > 0 && file.size > 1024 * 1024 * props.size) {
|
if (props.size > 0 && file.size > 1024 * 1024 * props.size) {
|
||||||
emit('uploadError', { msg: t('ui.cropper.imageTooBig') });
|
emit('uploadError', { msg: $t('ui.cropper.imageTooBig') });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
@ -122,9 +122,9 @@ async function handleOk() {
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:confirm-text="t('ui.cropper.okText')"
|
:confirm-text="$t('ui.cropper.okText')"
|
||||||
:fullscreen-button="false"
|
:fullscreen-button="false"
|
||||||
:title="t('ui.cropper.modalTitle')"
|
:title="$t('ui.cropper.modalTitle')"
|
||||||
class="w-[800px]"
|
class="w-[800px]"
|
||||||
>
|
>
|
||||||
<div :class="prefixCls">
|
<div :class="prefixCls">
|
||||||
|
@ -146,7 +146,7 @@ async function handleOk() {
|
||||||
:file-list="[]"
|
:file-list="[]"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
>
|
>
|
||||||
<Tooltip :title="t('ui.cropper.selectImage')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.selectImage')" placement="bottom">
|
||||||
<Button size="small" type="primary">
|
<Button size="small" type="primary">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<div class="flex items-center justify-center">
|
<div class="flex items-center justify-center">
|
||||||
|
@ -157,7 +157,7 @@ async function handleOk() {
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Upload>
|
</Upload>
|
||||||
<Space>
|
<Space>
|
||||||
<Tooltip :title="t('ui.cropper.btn_reset')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.btn_reset')" placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
:disabled="!src"
|
:disabled="!src"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -172,7 +172,7 @@ async function handleOk() {
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
:title="t('ui.cropper.btn_rotate_left')"
|
:title="$t('ui.cropper.btn_rotate_left')"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
@ -191,7 +191,7 @@ async function handleOk() {
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
:title="t('ui.cropper.btn_rotate_right')"
|
:title="$t('ui.cropper.btn_rotate_right')"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
@ -210,7 +210,7 @@ async function handleOk() {
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip :title="t('ui.cropper.btn_scale_x')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.btn_scale_x')" placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
:disabled="!src"
|
:disabled="!src"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -224,7 +224,7 @@ async function handleOk() {
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip :title="t('ui.cropper.btn_scale_y')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.btn_scale_y')" placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
:disabled="!src"
|
:disabled="!src"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -238,7 +238,7 @@ async function handleOk() {
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip :title="t('ui.cropper.btn_zoom_in')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.btn_zoom_in')" placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
:disabled="!src"
|
:disabled="!src"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -252,7 +252,7 @@ async function handleOk() {
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip :title="t('ui.cropper.btn_zoom_out')" placement="bottom">
|
<Tooltip :title="$t('ui.cropper.btn_zoom_out')" placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
:disabled="!src"
|
:disabled="!src"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -273,7 +273,7 @@ async function handleOk() {
|
||||||
<div :class="`${prefixCls}-preview`">
|
<div :class="`${prefixCls}-preview`">
|
||||||
<img
|
<img
|
||||||
v-if="previewSource"
|
v-if="previewSource"
|
||||||
:alt="t('ui.cropper.preview')"
|
:alt="$t('ui.cropper.preview')"
|
||||||
:src="previewSource"
|
:src="previewSource"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,7 +27,7 @@ const [Form, formApi] = useVbenForm({
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
labelWidth: 80,
|
labelWidth: 120,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: useFormSchema(),
|
schema: useFormSchema(),
|
||||||
|
@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle">
|
<Modal :title="getTitle" class="w-[40%]">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue