From 4908d55c7c611c3224cff28833cfec02c1ce3422 Mon Sep 17 00:00:00 2001 From: tyh2001 <1469442737@qq.com> Date: Wed, 15 Feb 2023 15:21:40 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=20ref=20=F0=9F=90=A7=F0=9F=90=A7=F0=9F=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vitepress/theme/components/vp-demo.vue | 2 +- packages/fighting-design/button/src/button.vue | 3 +-- .../collapse-animation/src/collapse-animation.vue | 5 ++--- packages/fighting-design/image/src/image.vue | 6 +++--- .../infinite-scrolling/src/infinite-scrolling.vue | 9 ++++++--- packages/fighting-design/ripple/src/ripple.vue | 10 ++++++---- packages/fighting-design/slider/src/slider.vue | 6 ++---- packages/fighting-design/up-load/src/up-load.vue | 8 ++++---- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/.vitepress/theme/components/vp-demo.vue b/docs/.vitepress/theme/components/vp-demo.vue index 1a219985da..f02cabb760 100644 --- a/docs/.vitepress/theme/components/vp-demo.vue +++ b/docs/.vitepress/theme/components/vp-demo.vue @@ -4,7 +4,7 @@ /** 是否展示内容 */ const isOpen = ref(false) /** 折叠的 dom 节点 */ - const content = ref(null) + const content = ref() /** 点击执行 */ const handleClick = () => { diff --git a/packages/fighting-design/button/src/button.vue b/packages/fighting-design/button/src/button.vue index 68ef99793b..11add5dfc6 100644 --- a/packages/fighting-design/button/src/button.vue +++ b/packages/fighting-design/button/src/button.vue @@ -5,7 +5,6 @@ import { FIconLoadingAVue } from '../../_svg' import { useRipples, useRun, useGlobal, useButton } from '../../_hooks' import type { RipplesOptions } from '../../_hooks' - import type { Ref } from 'vue' import type { FightingIcon } from '../../_interface' const prop = defineProps(Props) @@ -15,7 +14,7 @@ const { classList, styleList } = useButton(prop) /** 元素节点 */ - const FButtonEl: Ref = ref(null) + const FButtonEl = ref() /** * 按钮点击 diff --git a/packages/fighting-design/collapse-animation/src/collapse-animation.vue b/packages/fighting-design/collapse-animation/src/collapse-animation.vue index f9cce71f3d..c4b6442e92 100644 --- a/packages/fighting-design/collapse-animation/src/collapse-animation.vue +++ b/packages/fighting-design/collapse-animation/src/collapse-animation.vue @@ -1,15 +1,14 @@ diff --git a/packages/fighting-design/slider/src/slider.vue b/packages/fighting-design/slider/src/slider.vue index 3d971d444a..ac0a5d3a8f 100644 --- a/packages/fighting-design/slider/src/slider.vue +++ b/packages/fighting-design/slider/src/slider.vue @@ -3,9 +3,7 @@ import { onMounted, ref, computed } from 'vue' import { isNumber } from '../../_utils' import { useList, useSlider } from '../../_hooks' - // import { FTooltip } from '../../tooltip' import { EMIT_UPDATE } from '../../_tokens' - import type { Ref } from 'vue' const prop = defineProps(Props) const emit = defineEmits({ @@ -15,9 +13,9 @@ const { styles, classes } = useList(prop, 'slider') /** dom 元素 */ - const sliderEl: Ref = ref(null) + const sliderEl = ref() /** 滑块小球 dom 元素 */ - const sliderCircle: Ref = ref(null) + const sliderCircle= ref() /** 便宜距离 */ const offset = ref(0) diff --git a/packages/fighting-design/up-load/src/up-load.vue b/packages/fighting-design/up-load/src/up-load.vue index deae303e1e..6a17dfc036 100644 --- a/packages/fighting-design/up-load/src/up-load.vue +++ b/packages/fighting-design/up-load/src/up-load.vue @@ -7,7 +7,6 @@ import { FCloseBtn } from '../../close-btn' import { FIconNotesVue, FIconPlusVue } from '../../_svg' import { EMIT_FILES } from '../../_tokens' - import type { Ref } from 'vue' const prop = defineProps(Props) const emit = defineEmits({ @@ -20,11 +19,11 @@ const fileList = ref(null as unknown as File[]) /** 文件上传输入框 */ - const inputEl: Ref = ref(null) + const inputEl = ref() /** 点击上传 */ const handleClick = (): void => { - ;(inputEl.value as HTMLInputElement).click() + inputEl.value && inputEl.value.click() } /** @@ -80,10 +79,11 @@ /** * 删除文件 * + * @see Array.prototype.splice() https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/splice * @param { number } index 需要删除的文件索引 */ const removeFile = (index: number): void => { - ;(fileList.value as File[]).splice(index, 1) + fileList.value.splice(index, 1) } /**