From 9a339a52a94c4b0c719bd419124971cc37e0c763 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Tue, 3 Oct 2023 17:22:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=BF=E6=8D=A2Button=E3=80=81Ra?= =?UTF-8?q?dioButton=E3=80=81NumberInput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Button.vue | 10 +++++++ src/components/ButtonGroup.vue | 2 +- src/components/NumberInput.vue | 4 ++- src/views/Editor/Canvas/LinkDialog.vue | 6 ++-- src/views/Editor/CanvasTool/MediaInput.vue | 2 +- .../Editor/CanvasTool/TableGenerator.vue | 10 +++---- src/views/Editor/ExportDialog/ExportImage.vue | 9 +++--- src/views/Editor/ExportDialog/ExportJSON.vue | 3 +- src/views/Editor/ExportDialog/ExportPDF.vue | 15 +++++----- src/views/Editor/ExportDialog/ExportPPTX.vue | 8 ++--- .../ExportDialog/ExportSpecificFile.vue | 8 ++--- src/views/Editor/SearchPanel.vue | 2 +- src/views/Editor/SelectPanel.vue | 2 +- .../Editor/Toolbar/ElementAnimationPanel.vue | 8 ++--- .../Editor/Toolbar/ElementPositionPanel.vue | 29 +++++++++---------- .../ChartStylePanel/ChartDataEditor.vue | 3 +- .../ChartStylePanel/index.vue | 8 ++--- .../ElementStylePanel/ImageStylePanel.vue | 21 +++++++------- .../ElementStylePanel/LatexStylePanel.vue | 12 ++++---- .../ElementStylePanel/LineStylePanel.vue | 6 ++-- .../ElementStylePanel/MultiStylePanel.vue | 18 ++++++------ .../ElementStylePanel/ShapeStylePanel.vue | 21 +++++++------- .../ElementStylePanel/TableStylePanel.vue | 17 +++++------ .../ElementStylePanel/TextStylePanel.vue | 23 +++++++-------- .../ElementStylePanel/VideoStylePanel.vue | 2 +- .../Editor/Toolbar/MultiPositionPanel.vue | 5 ++-- .../Editor/Toolbar/SlideAnimationPanel.vue | 3 +- src/views/Editor/Toolbar/SlideDesignPanel.vue | 2 +- .../Editor/Toolbar/common/ColorButton.vue | 4 +-- .../Editor/Toolbar/common/ElementOutline.vue | 8 ++--- .../Editor/Toolbar/common/TextColorButton.vue | 4 +-- .../Mobile/MobileEditor/ElementToolbar.vue | 17 +++++------ .../Mobile/MobileEditor/SlideToolbar.vue | 5 ++-- 33 files changed, 143 insertions(+), 154 deletions(-) diff --git a/src/components/Button.vue b/src/components/Button.vue index 607edffd..d3509bc4 100644 --- a/src/components/Button.vue +++ b/src/components/Button.vue @@ -8,6 +8,7 @@ 'primary': !disabled && type === 'primary', 'checkbox': !disabled && type === 'checkbox', 'radio': !disabled && type === 'radio', + 'small': size === 'small', }" @click="handleClick()" > @@ -20,10 +21,12 @@ const props = withDefaults(defineProps<{ checked?: boolean disabled?: boolean type?: 'default' | 'primary' | 'checkbox' | 'radio' + size?: 'small' | 'normal' }>(), { checked: false, disabled: false, type: 'default', + size: 'normal', }) const emit = defineEmits<{ @@ -50,6 +53,13 @@ const handleClick = () => { letter-spacing: 1px; cursor: pointer; + &.small { + height: 24px; + line-height: 24px; + padding: 0 7px; + letter-spacing: 0; + } + &.default { background-color: #fff; border: 1px solid #d9d9d9; diff --git a/src/components/ButtonGroup.vue b/src/components/ButtonGroup.vue index a527d096..3bfd491d 100644 --- a/src/components/ButtonGroup.vue +++ b/src/components/ButtonGroup.vue @@ -24,7 +24,7 @@ } &:hover { - &.default + .button.default { + &.default + .button { border-left-color: $themeColor; } } diff --git a/src/components/NumberInput.vue b/src/components/NumberInput.vue index 75a338df..4dcd1427 100644 --- a/src/components/NumberInput.vue +++ b/src/components/NumberInput.vue @@ -70,11 +70,13 @@ watch(() => props.value, () => { if (props.value !== number.value) { number.value = props.value } +}, { + immediate: true, }) watch(number, () => { let value = +number.value - if (isNaN(value)) value = 0 + if (isNaN(value)) value = props.min else if (value > props.max) value = props.max else if (value < props.min) value = props.min diff --git a/src/views/Editor/Canvas/LinkDialog.vue b/src/views/Editor/Canvas/LinkDialog.vue index bdb0314d..0934185b 100644 --- a/src/views/Editor/Canvas/LinkDialog.vue +++ b/src/views/Editor/Canvas/LinkDialog.vue @@ -48,10 +48,8 @@ import useLink from '@/hooks/useLink' import ThumbnailSlide from '@/views/components/ThumbnailSlide/index.vue' import Tabs from '@/components/Tabs.vue' import Input from '@/components/Input.vue' -import { - Button, - Select, -} from 'ant-design-vue' +import Button from '@/components/Button.vue' +import { Select } from 'ant-design-vue' const SelectOption = Select.Option type TypeKey = 'web' | 'slide' diff --git a/src/views/Editor/CanvasTool/MediaInput.vue b/src/views/Editor/CanvasTool/MediaInput.vue index 8a419870..854d614d 100644 --- a/src/views/Editor/CanvasTool/MediaInput.vue +++ b/src/views/Editor/CanvasTool/MediaInput.vue @@ -26,10 +26,10 @@