Browse Source

fix: eslint

main
xingyu 2 years ago
parent
commit
54e93835d6
  1. 19
      src/components/Icon/src/IconPicker.vue
  2. 8
      src/components/Modal/src/BasicModal.vue
  3. 8
      src/components/Modal/src/components/ModalWrapper.vue
  4. 6
      src/components/Preview/src/Functional.vue

19
src/components/Icon/src/IconPicker.vue

@ -23,11 +23,6 @@ const props = defineProps({
mode: propTypes.oneOf(['svg', 'iconify']).def('iconify'), mode: propTypes.oneOf(['svg', 'iconify']).def('iconify'),
}) })
const emit = defineEmits(['change', 'update:value']) const emit = defineEmits(['change', 'update:value'])
// 使WebStormunused
const AInput = Input
const APopover = Popover
const APagination = Pagination
const AEmpty = Empty
function getIcons() { function getIcons() {
const data = iconsData as any const data = iconsData as any
@ -107,12 +102,12 @@ function handleSearchChange(e: ChangeEvent) {
</script> </script>
<template> <template>
<AInput v-model:value="currentSelect" disabled :style="{ width }" :placeholder="t('component.icon.placeholder')" :class="prefixCls"> <Input v-model:value="currentSelect" disabled :style="{ width }" :placeholder="t('component.icon.placeholder')" :class="prefixCls">
<template #addonAfter> <template #addonAfter>
<APopover v-model="open" placement="bottomLeft" trigger="click" :overlay-class-name="`${prefixCls}-popover`"> <Popover v-model="open" placement="bottomLeft" trigger="click" :overlay-class-name="`${prefixCls}-popover`">
<template #title> <template #title>
<div class="flex justify-between"> <div class="flex justify-between">
<AInput :placeholder="t('component.icon.search')" allow-clear @change="debounceHandleSearchChange" /> <Input :placeholder="t('component.icon.search')" allow-clear @change="debounceHandleSearchChange" />
</div> </div>
</template> </template>
@ -135,12 +130,12 @@ function handleSearchChange(e: ChangeEvent) {
</ul> </ul>
</ScrollContainer> </ScrollContainer>
<div v-if="getTotal >= pageSize" class="flex py-2 items-center justify-center"> <div v-if="getTotal >= pageSize" class="flex py-2 items-center justify-center">
<APagination show-less-items size="small" :page-size="pageSize" :total="getTotal" @change="handlePageChange" /> <Pagination show-less-items size="small" :page-size="pageSize" :total="getTotal" @change="handlePageChange" />
</div> </div>
</div> </div>
<template v-else> <template v-else>
<div class="p-5"> <div class="p-5">
<AEmpty /> <Empty />
</div> </div>
</template> </template>
</template> </template>
@ -149,9 +144,9 @@ function handleSearchChange(e: ChangeEvent) {
<SvgIcon :name="currentSelect" /> <SvgIcon :name="currentSelect" />
</span> </span>
<Icon v-else :icon="currentSelect || 'ion:apps-outline'" class="cursor-pointer px-2 py-1" /> <Icon v-else :icon="currentSelect || 'ion:apps-outline'" class="cursor-pointer px-2 py-1" />
</APopover> </Popover>
</template> </template>
</AInput> </Input>
</template> </template>
<style lang="less"> <style lang="less">

8
src/components/Modal/src/BasicModal.vue

@ -17,7 +17,7 @@ import { useDesign } from '@/hooks/web/useDesign'
defineOptions({ name: 'BasicModal', inheritAttrs: false }) defineOptions({ name: 'BasicModal', inheritAttrs: false })
const props = defineProps(basicProps) const props = defineProps(basicProps)
const emit = defineEmits(['open-change', 'height-change', 'cancel', 'ok', 'register', 'update:open']) const emit = defineEmits(['openChange', 'heightChange', 'cancel', 'ok', 'register', 'update:open'])
const attrs = useAttrs() const attrs = useAttrs()
const openRef = ref(false) const openRef = ref(false)
const propsRef = ref<Partial<ModalProps> | null>(null) const propsRef = ref<Partial<ModalProps> | null>(null)
@ -72,7 +72,7 @@ const getProps = computed((): Recordable => {
}) })
const getBindValue = computed((): Recordable => { const getBindValue = computed((): Recordable => {
const attr = { const attr: any = {
...attrs, ...attrs,
...unref(getMergeProps), ...unref(getMergeProps),
open: unref(openRef), open: unref(openRef),
@ -98,7 +98,7 @@ watchEffect(() => {
watch( watch(
() => unref(openRef), () => unref(openRef),
(v) => { (v) => {
emit('open-change', v) emit('openChange', v)
emit('update:open', v) emit('update:open', v)
instance && modalMethods.emitOpen?.(v, instance.uid) instance && modalMethods.emitOpen?.(v, instance.uid)
nextTick(() => { nextTick(() => {
@ -146,7 +146,7 @@ function handleOk(e: Event) {
} }
function handleHeightChange(height: string) { function handleHeightChange(height: string) {
emit('height-change', height) emit('heightChange', height)
} }
function handleExtHeight(height: number) { function handleExtHeight(height: number) {

8
src/components/Modal/src/components/ModalWrapper.vue

@ -20,7 +20,7 @@ const props = defineProps({
fullScreen: { type: Boolean }, fullScreen: { type: Boolean },
loadingTip: { type: String }, loadingTip: { type: String },
}) })
const emit = defineEmits(['height-change', 'ext-height']) const emit = defineEmits(['heightChange', 'extHeight'])
const wrapperRef = ref<ComponentRef>(null) const wrapperRef = ref<ComponentRef>(null)
const spinRef = ref<ElRef>(null) const spinRef = ref<ElRef>(null)
const realHeightRef = ref(0) const realHeightRef = ref(0)
@ -30,7 +30,7 @@ let realHeight = 0
const stopElResizeFn: Fn = () => {} const stopElResizeFn: Fn = () => {}
useWindowSizeFn(setModalHeight.bind(null, false)) useWindowSizeFn(setModalHeight.bind(false))
useMutationObserver( useMutationObserver(
spinRef, spinRef,
@ -71,7 +71,7 @@ watch(
onMounted(() => { onMounted(() => {
const { modalHeaderHeight, modalFooterHeight } = props const { modalHeaderHeight, modalFooterHeight } = props
emit('ext-height', modalHeaderHeight + modalFooterHeight) emit('extHeight', modalHeaderHeight + modalFooterHeight)
}) })
onUnmounted(() => { onUnmounted(() => {
@ -130,7 +130,7 @@ async function setModalHeight() {
else else
realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight
emit('height-change', unref(realHeightRef)) emit('heightChange', unref(realHeightRef))
} }
catch (error) { catch (error) {
console.log(error) console.log(error)

6
src/components/Preview/src/Functional.vue

@ -55,7 +55,7 @@ const prefixCls = 'img-preview'
export default defineComponent({ export default defineComponent({
name: 'ImagePreview', name: 'ImagePreview',
props, props,
emits: ['img-load', 'img-error'], emits: ['imgLoad', 'imgError'],
setup(props, { expose, emit }) { setup(props, { expose, emit }) {
interface stateInfo { interface stateInfo {
scale: number scale: number
@ -201,7 +201,7 @@ export default defineComponent({
} }
ele ele
&& emit('img-load', { && emit('imgLoad', {
index: imgState.currentIndex, index: imgState.currentIndex,
dom: ele[0] as HTMLImageElement, dom: ele[0] as HTMLImageElement,
url, url,
@ -213,7 +213,7 @@ export default defineComponent({
img.onerror = (e: Event) => { img.onerror = (e: Event) => {
const ele: EventTarget[] = e.composedPath() const ele: EventTarget[] = e.composedPath()
ele ele
&& emit('img-error', { && emit('imgError', {
index: imgState.currentIndex, index: imgState.currentIndex,
dom: ele[0] as HTMLImageElement, dom: ele[0] as HTMLImageElement,
url, url,