From 142bfb772ba283ae47e64b6bec11334bc7781d31 Mon Sep 17 00:00:00 2001 From: fzh <1399952343@qq.com> Date: Mon, 25 Dec 2023 18:53:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=80=BC=E4=B8=BA=E7=A9=BA=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E6=8F=90=E7=A4=BAVue=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f28e27ce5..891d08a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - 支持表格批操作工具栏、快速工具栏:表格批操作工具栏放在表头、快速工具栏放在表格中间 - 下拉列表支持代码表样式、颜色、图片等显示 +### Fixed + +- 修复数值编辑器初始化时,默认值为空字符串提示Vue报错,且错误展示为数字0 + ## [0.5.0-beta.0] - 2023-12-24 ### Added diff --git a/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx b/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx index 30a0c0053..d2ea797fe 100644 --- a/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx +++ b/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx @@ -5,6 +5,7 @@ import { useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-input-number.scss'; +import { isNilOrEmpty } from 'qx-util'; import { TextBoxEditorController } from '../text-box-editor.controller'; export const IBizInputNumber = defineComponent({ @@ -16,7 +17,7 @@ export const IBizInputNumber = defineComponent({ const c = props.controller; - const currentVal = ref(''); + const currentVal = ref(null); watch( () => props.value, @@ -77,7 +78,7 @@ export const IBizInputNumber = defineComponent({ let content = null; if (this.readonly) { // 只读显示 - content = `${this.currentVal}`; + content = isNilOrEmpty(this.currentVal) ? '' : `${this.currentVal}`; // 当有值且单位存在时才显示单位 if (content && unitName) { content += unitName; -- Gitee