From b68bb81652734390bed40bf4785c3b9d4cb964fc Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Fri, 28 May 2021 13:42:22 +0800 Subject: [PATCH] refactor: typography --- components/typography/Base.tsx | 30 +++++++++++--------------- components/typography/style/index.less | 5 ++++- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index f29b6cb2a..0ec617ee2 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -17,7 +17,6 @@ import EditOutlined from '@ant-design/icons-vue/EditOutlined'; import { defineComponent, VNodeTypes, - VNode, reactive, ref, onMounted, @@ -170,14 +169,6 @@ const Base = defineComponent({ } }); - function saveTypographyRef(node: VNode) { - contentRef.value = node; - } - - function saveEditIconRef(node: VNode) { - editIcon.value = node; - } - function getChildrenText(): string { return props.ellipsis || props.editable ? props.content : contentRef.value?.$el?.innerText; } @@ -208,6 +199,7 @@ const Base = defineComponent({ } function onEditCancel() { + editable.value.onCancel?.(); triggerEdit(false); } @@ -375,7 +367,7 @@ const Base = defineComponent({ return ( ({ function renderEditInput() { const { class: className, style } = attrs; - const { maxlength, autoSize } = editable.value; + const { maxlength, autoSize, onEnd } = editable.value; return ( ({ onSave={onEditChange} onChange={onContentChange} onCancel={onEditCancel} + onEnd={onEnd} /> ); } @@ -529,13 +522,16 @@ const Base = defineComponent({ return (