mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
style(eslint): fix eslint error
This commit is contained in:
parent
26adbc92be
commit
3c441a05da
@ -1,11 +1,13 @@
|
||||
<template>
|
||||
<span :class="$attrs.class">
|
||||
<g-icon :icon="icon" />
|
||||
<Icon :icon="icon" />
|
||||
</span>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { Icon } from '/@/components/Icon';
|
||||
export default defineComponent({
|
||||
components: { Icon },
|
||||
props: {
|
||||
icon: String,
|
||||
},
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div :class="getClass" @click.stop v-if="visible">
|
||||
<div :class="`${prefixCls}-content`" v-click-outside="handleClose">
|
||||
<div :class="`${prefixCls}-input__wrapper`">
|
||||
<a-input
|
||||
<Input
|
||||
:class="`${prefixCls}-input`"
|
||||
:placeholder="t('common.searchText')"
|
||||
allow-clear
|
||||
@ -14,7 +14,7 @@
|
||||
<!-- <Icon icon="ion:search"/> -->
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
</a-input>
|
||||
</Input>
|
||||
<span :class="`${prefixCls}-cancel`" @click="handleClose">
|
||||
{{ t('common.cancelText') }}
|
||||
</span>
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
export default defineComponent({
|
||||
name: 'AppSearchModal',
|
||||
components: { Icon, SearchOutlined, AppSearchFooter, [Input.name]: Input },
|
||||
components: { Icon, SearchOutlined, AppSearchFooter, Input },
|
||||
directives: {
|
||||
clickOutside,
|
||||
},
|
||||
|
@ -21,7 +21,7 @@
|
||||
name: 'CountButton',
|
||||
components: { Button },
|
||||
props: {
|
||||
value: propTypes.string,
|
||||
value: propTypes.any,
|
||||
count: propTypes.number.def(60),
|
||||
beforeStartFunc: {
|
||||
type: Function as PropType<() => boolean>,
|
||||
|
@ -57,18 +57,19 @@
|
||||
default: '360px',
|
||||
},
|
||||
crossorigin: {
|
||||
type: String,
|
||||
type: String as PropType<'' | 'anonymous' | 'use-credentials' | undefined>,
|
||||
default: undefined,
|
||||
},
|
||||
imageStyle: {
|
||||
type: Object as PropType<CSSProperties>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
options: {
|
||||
type: Object as PropType<Options>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
emits: ['cropperedInfo'],
|
||||
setup(props, ctx) {
|
||||
const imgElRef = ref<ElRef<HTMLImageElement>>(null);
|
||||
const cropper: any = ref<Nullable<Cropper>>(null);
|
||||
@ -109,17 +110,17 @@
|
||||
// event: return base64 and width and height information after cropping
|
||||
const croppered = (): void => {
|
||||
let imgInfo = cropper.value.getData();
|
||||
cropper.value.getCroppedCanvas().toBlob(blob => {
|
||||
let fileReader: FileReader = new FileReader()
|
||||
cropper.value.getCroppedCanvas().toBlob((blob) => {
|
||||
let fileReader: FileReader = new FileReader();
|
||||
fileReader.onloadend = (e: any) => {
|
||||
ctx.emit("cropperedInfo", {
|
||||
ctx.emit('cropperedInfo', {
|
||||
imgBase64: e.target.result,
|
||||
imgInfo
|
||||
})
|
||||
}
|
||||
fileReader.readAsDataURL(blob)
|
||||
}, 'image/jpeg')
|
||||
}
|
||||
imgInfo,
|
||||
});
|
||||
};
|
||||
fileReader.readAsDataURL(blob);
|
||||
}, 'image/jpeg');
|
||||
};
|
||||
|
||||
onMounted(init);
|
||||
|
||||
|
@ -67,15 +67,15 @@
|
||||
showAdvancedButton: propTypes.bool.def(true),
|
||||
resetButtonOptions: {
|
||||
type: Object as PropType<ButtonOptions>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
submitButtonOptions: {
|
||||
type: Object as PropType<ButtonOptions>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
actionColOptions: {
|
||||
type: Object as PropType<Partial<ColEx>>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
actionSpan: propTypes.number.def(6),
|
||||
isAdvanced: propTypes.bool,
|
||||
|
@ -28,15 +28,15 @@
|
||||
},
|
||||
formProps: {
|
||||
type: Object as PropType<FormProps>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
allDefaultValues: {
|
||||
type: Object as PropType<Recordable>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
formModel: {
|
||||
type: Object as PropType<Recordable>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
setFormModel: {
|
||||
type: Function as PropType<(key: string, value: any) => void>,
|
||||
|
@ -14,7 +14,7 @@
|
||||
props: {
|
||||
item: {
|
||||
type: Object as PropType<Menu>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
dot: propTypes.bool,
|
||||
collapseParent: propTypes.bool,
|
||||
|
@ -64,7 +64,7 @@
|
||||
props: {
|
||||
item: {
|
||||
type: Object as PropType<Menu>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
parent: propTypes.bool,
|
||||
collapsedShowTitle: propTypes.bool,
|
||||
|
@ -30,7 +30,7 @@
|
||||
activeName: propTypes.oneOfType([propTypes.string, propTypes.number]),
|
||||
openNames: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: [],
|
||||
default: () => [],
|
||||
},
|
||||
accordion: propTypes.bool.def(true),
|
||||
width: propTypes.string.def('100%'),
|
||||
@ -39,7 +39,7 @@
|
||||
collapse: propTypes.bool.def(true),
|
||||
activeSubMenuNames: {
|
||||
type: Array as PropType<(string | number)[]>,
|
||||
default: [],
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
emits: ['select', 'open-change'],
|
||||
|
@ -23,7 +23,7 @@
|
||||
props: {
|
||||
column: {
|
||||
type: Object as PropType<BasicColumn>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
@ -60,7 +60,7 @@
|
||||
},
|
||||
column: {
|
||||
type: Object as PropType<BasicColumn>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
index: propTypes.number,
|
||||
},
|
||||
|
@ -30,7 +30,7 @@
|
||||
props: {
|
||||
setting: {
|
||||
type: Object as PropType<TableSetting>,
|
||||
default: {},
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
@ -41,7 +41,7 @@
|
||||
},
|
||||
options: {
|
||||
type: Array as PropType<LabelValueOptions>,
|
||||
default: [],
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
@ -34,8 +34,8 @@ export function useLocale() {
|
||||
const getLocale = computed(() => localeStore.getLocale);
|
||||
const getShowLocalePicker = computed(() => localeStore.getShowPicker);
|
||||
|
||||
const getAntdLocale = computed(() => {
|
||||
return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale;
|
||||
const getAntdLocale = computed((): any => {
|
||||
return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {};
|
||||
});
|
||||
|
||||
// Switching the language will change the locale of useI18n
|
||||
|
@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<PageWrapper title="图片裁剪示例" contentBackground>
|
||||
<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>
|
||||
<img :src="cropperImg" class="croppered" v-if="cropperImg" />
|
||||
</div>
|
||||
@ -20,41 +25,42 @@
|
||||
},
|
||||
setup() {
|
||||
let vm: any;
|
||||
let info = ref("");
|
||||
let cropperImg = ref("");
|
||||
let info = ref('');
|
||||
let cropperImg = ref('');
|
||||
|
||||
const onCropper = (): void => {
|
||||
vm.refs.refCropper.croppered();
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeMount(()=>{
|
||||
onBeforeMount(() => {
|
||||
vm = getCurrentInstance();
|
||||
})
|
||||
});
|
||||
|
||||
function cropperedInfo({ imgBase64, imgInfo }) {
|
||||
info.value = imgInfo
|
||||
cropperImg.value = imgBase64
|
||||
}
|
||||
function cropperedInfo({ imgBase64, imgInfo }) {
|
||||
info.value = imgInfo;
|
||||
cropperImg.value = imgBase64;
|
||||
}
|
||||
|
||||
return {
|
||||
img,
|
||||
info,
|
||||
cropperImg,
|
||||
onCropper,
|
||||
cropperedInfo
|
||||
cropperedInfo,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cropper-container {
|
||||
display:flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
.croppered {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
.cropper-container {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.croppered {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user