提交 3c441a05 编写于 作者: V Vben

style(eslint): fix eslint error

上级 26adbc92
<template> <template>
<span :class="$attrs.class"> <span :class="$attrs.class">
<g-icon :icon="icon" /> <Icon :icon="icon" />
</span> </span>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { Icon } from '/@/components/Icon';
export default defineComponent({ export default defineComponent({
components: { Icon },
props: { props: {
icon: String, icon: String,
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div :class="getClass" @click.stop v-if="visible"> <div :class="getClass" @click.stop v-if="visible">
<div :class="`${prefixCls}-content`" v-click-outside="handleClose"> <div :class="`${prefixCls}-content`" v-click-outside="handleClose">
<div :class="`${prefixCls}-input__wrapper`"> <div :class="`${prefixCls}-input__wrapper`">
<a-input <Input
:class="`${prefixCls}-input`" :class="`${prefixCls}-input`"
:placeholder="t('common.searchText')" :placeholder="t('common.searchText')"
allow-clear allow-clear
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- <Icon icon="ion:search"/> --> <!-- <Icon icon="ion:search"/> -->
<SearchOutlined /> <SearchOutlined />
</template> </template>
</a-input> </Input>
<span :class="`${prefixCls}-cancel`" @click="handleClose"> <span :class="`${prefixCls}-cancel`" @click="handleClose">
{{ t('common.cancelText') }} {{ t('common.cancelText') }}
</span> </span>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
export default defineComponent({ export default defineComponent({
name: 'AppSearchModal', name: 'AppSearchModal',
components: { Icon, SearchOutlined, AppSearchFooter, [Input.name]: Input }, components: { Icon, SearchOutlined, AppSearchFooter, Input },
directives: { directives: {
clickOutside, clickOutside,
}, },
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
name: 'CountButton', name: 'CountButton',
components: { Button }, components: { Button },
props: { props: {
value: propTypes.string, value: propTypes.any,
count: propTypes.number.def(60), count: propTypes.number.def(60),
beforeStartFunc: { beforeStartFunc: {
type: Function as PropType<() => boolean>, type: Function as PropType<() => boolean>,
......
...@@ -57,18 +57,19 @@ ...@@ -57,18 +57,19 @@
default: '360px', default: '360px',
}, },
crossorigin: { crossorigin: {
type: String, type: String as PropType<'' | 'anonymous' | 'use-credentials' | undefined>,
default: undefined, default: undefined,
}, },
imageStyle: { imageStyle: {
type: Object as PropType<CSSProperties>, type: Object as PropType<CSSProperties>,
default: {}, default: () => {},
}, },
options: { options: {
type: Object as PropType<Options>, type: Object as PropType<Options>,
default: {}, default: () => {},
}, },
}, },
emits: ['cropperedInfo'],
setup(props, ctx) { setup(props, ctx) {
const imgElRef = ref<ElRef<HTMLImageElement>>(null); const imgElRef = ref<ElRef<HTMLImageElement>>(null);
const cropper: any = ref<Nullable<Cropper>>(null); const cropper: any = ref<Nullable<Cropper>>(null);
...@@ -109,17 +110,17 @@ ...@@ -109,17 +110,17 @@
// event: return base64 and width and height information after cropping // event: return base64 and width and height information after cropping
const croppered = (): void => { const croppered = (): void => {
let imgInfo = cropper.value.getData(); let imgInfo = cropper.value.getData();
cropper.value.getCroppedCanvas().toBlob(blob => { cropper.value.getCroppedCanvas().toBlob((blob) => {
let fileReader: FileReader = new FileReader() let fileReader: FileReader = new FileReader();
fileReader.onloadend = (e: any) => { fileReader.onloadend = (e: any) => {
ctx.emit("cropperedInfo", { ctx.emit('cropperedInfo', {
imgBase64: e.target.result, imgBase64: e.target.result,
imgInfo imgInfo,
}) });
} };
fileReader.readAsDataURL(blob) fileReader.readAsDataURL(blob);
}, 'image/jpeg') }, 'image/jpeg');
} };
onMounted(init); onMounted(init);
......
...@@ -67,15 +67,15 @@ ...@@ -67,15 +67,15 @@
showAdvancedButton: propTypes.bool.def(true), showAdvancedButton: propTypes.bool.def(true),
resetButtonOptions: { resetButtonOptions: {
type: Object as PropType<ButtonOptions>, type: Object as PropType<ButtonOptions>,
default: {}, default: () => {},
}, },
submitButtonOptions: { submitButtonOptions: {
type: Object as PropType<ButtonOptions>, type: Object as PropType<ButtonOptions>,
default: {}, default: () => {},
}, },
actionColOptions: { actionColOptions: {
type: Object as PropType<Partial<ColEx>>, type: Object as PropType<Partial<ColEx>>,
default: {}, default: () => {},
}, },
actionSpan: propTypes.number.def(6), actionSpan: propTypes.number.def(6),
isAdvanced: propTypes.bool, isAdvanced: propTypes.bool,
......
...@@ -28,15 +28,15 @@ ...@@ -28,15 +28,15 @@
}, },
formProps: { formProps: {
type: Object as PropType<FormProps>, type: Object as PropType<FormProps>,
default: {}, default: () => {},
}, },
allDefaultValues: { allDefaultValues: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,
default: {}, default: () => {},
}, },
formModel: { formModel: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,
default: {}, default: () => {},
}, },
setFormModel: { setFormModel: {
type: Function as PropType<(key: string, value: any) => void>, type: Function as PropType<(key: string, value: any) => void>,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
props: { props: {
item: { item: {
type: Object as PropType<Menu>, type: Object as PropType<Menu>,
default: {}, default: () => {},
}, },
dot: propTypes.bool, dot: propTypes.bool,
collapseParent: propTypes.bool, collapseParent: propTypes.bool,
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
props: { props: {
item: { item: {
type: Object as PropType<Menu>, type: Object as PropType<Menu>,
default: {}, default: () => {},
}, },
parent: propTypes.bool, parent: propTypes.bool,
collapsedShowTitle: propTypes.bool, collapsedShowTitle: propTypes.bool,
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
activeName: propTypes.oneOfType([propTypes.string, propTypes.number]), activeName: propTypes.oneOfType([propTypes.string, propTypes.number]),
openNames: { openNames: {
type: Array as PropType<string[]>, type: Array as PropType<string[]>,
default: [], default: () => [],
}, },
accordion: propTypes.bool.def(true), accordion: propTypes.bool.def(true),
width: propTypes.string.def('100%'), width: propTypes.string.def('100%'),
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
collapse: propTypes.bool.def(true), collapse: propTypes.bool.def(true),
activeSubMenuNames: { activeSubMenuNames: {
type: Array as PropType<(string | number)[]>, type: Array as PropType<(string | number)[]>,
default: [], default: () => [],
}, },
}, },
emits: ['select', 'open-change'], emits: ['select', 'open-change'],
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
props: { props: {
column: { column: {
type: Object as PropType<BasicColumn>, type: Object as PropType<BasicColumn>,
default: {}, default: () => {},
}, },
}, },
setup(props) { setup(props) {
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
}, },
column: { column: {
type: Object as PropType<BasicColumn>, type: Object as PropType<BasicColumn>,
default: {}, default: () => {},
}, },
index: propTypes.number, index: propTypes.number,
}, },
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
props: { props: {
setting: { setting: {
type: Object as PropType<TableSetting>, type: Object as PropType<TableSetting>,
default: {}, default: () => {},
}, },
}, },
setup(props) { setup(props) {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
}, },
options: { options: {
type: Array as PropType<LabelValueOptions>, type: Array as PropType<LabelValueOptions>,
default: [], default: () => [],
}, },
}, },
setup(props) { setup(props) {
......
...@@ -34,8 +34,8 @@ export function useLocale() { ...@@ -34,8 +34,8 @@ export function useLocale() {
const getLocale = computed(() => localeStore.getLocale); const getLocale = computed(() => localeStore.getLocale);
const getShowLocalePicker = computed(() => localeStore.getShowPicker); const getShowLocalePicker = computed(() => localeStore.getShowPicker);
const getAntdLocale = computed(() => { const getAntdLocale = computed((): any => {
return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale; return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {};
}); });
// Switching the language will change the locale of useI18n // Switching the language will change the locale of useI18n
......
<template> <template>
<PageWrapper title="图片裁剪示例" contentBackground> <PageWrapper title="图片裁剪示例" contentBackground>
<div class="cropper-container"> <div class="cropper-container">
<CropperImage ref="refCropper" src="https://fengyuanchen.github.io/cropperjs/images/picture.jpg" @cropperedInfo="cropperedInfo" style="width:40%" /> <CropperImage
ref="refCropper"
src="https://fengyuanchen.github.io/cropperjs/images/picture.jpg"
@cropperedInfo="cropperedInfo"
style="width: 40%"
/>
<a-button type="primary" @click="onCropper"> 裁剪 </a-button> <a-button type="primary" @click="onCropper"> 裁剪 </a-button>
<img :src="cropperImg" class="croppered" v-if="cropperImg" /> <img :src="cropperImg" class="croppered" v-if="cropperImg" />
</div> </div>
...@@ -20,41 +25,42 @@ ...@@ -20,41 +25,42 @@
}, },
setup() { setup() {
let vm: any; let vm: any;
let info = ref(""); let info = ref('');
let cropperImg = ref(""); let cropperImg = ref('');
const onCropper = (): void => { const onCropper = (): void => {
vm.refs.refCropper.croppered(); vm.refs.refCropper.croppered();
} };
onBeforeMount(()=>{ onBeforeMount(() => {
vm = getCurrentInstance(); vm = getCurrentInstance();
}) });
function cropperedInfo({ imgBase64, imgInfo }) { function cropperedInfo({ imgBase64, imgInfo }) {
info.value = imgInfo info.value = imgInfo;
cropperImg.value = imgBase64 cropperImg.value = imgBase64;
} }
return { return {
img, img,
info, info,
cropperImg, cropperImg,
onCropper, onCropper,
cropperedInfo cropperedInfo,
}; };
}, },
}); });
</script> </script>
<style scoped> <style scoped>
.cropper-container { .cropper-container {
display:flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
} }
.croppered {
width: 50%; .croppered {
height: 100%; width: 50%;
} height: 100%;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册