From 2036a9ef6f27ba1e4f7d0fa19237f69712b87b52 Mon Sep 17 00:00:00 2001 From: dingyongya Date: Tue, 24 May 2022 19:15:57 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20tooltip,table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tooltip 新增isAutoShow属性 目的控制超出文本 `...` 时自动展示, 没有 `...` 时不展示 table 列添加ellipsisTooltip属性时,无 `...` 的不显示tooltip效果 --- .../component/src/component/popper/index.vue | 2 ++ .../component/src/component/table/index.vue | 13 +++----- .../src/component/tooltip/index.less | 6 ++++ .../component/src/component/tooltip/index.vue | 26 +++++++++++++-- .../src/document/zh-CN/components/table.md | 1 + .../src/document/zh-CN/components/tooltip.md | 33 +++++++++++++++++++ pnpm-lock.yaml | 4 +-- 7 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 package/component/src/component/tooltip/index.less diff --git a/package/component/src/component/popper/index.vue b/package/component/src/component/popper/index.vue index 9ce72399..eb8074af 100644 --- a/package/component/src/component/popper/index.vue +++ b/package/component/src/component/popper/index.vue @@ -35,6 +35,7 @@ export interface LayPopperProps { isDark?: boolean; disabled?: boolean; isCanHide?: boolean; + isAutoShow?: boolean; } const props = withDefaults(defineProps(), { @@ -43,6 +44,7 @@ const props = withDefaults(defineProps(), { disabled: false, enterable: true, isCanHide: true, + isAutoShow: false, trigger: "hover", }); diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index a85f41d2..290fc619 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -354,13 +354,9 @@ onMounted(() => { -
- -
+
{ -
- {{ data[column.key] }} -
+ {{ data[column.key] }}
{{ data[column.key] }} diff --git a/package/component/src/component/tooltip/index.less b/package/component/src/component/tooltip/index.less new file mode 100644 index 00000000..53f10472 --- /dev/null +++ b/package/component/src/component/tooltip/index.less @@ -0,0 +1,6 @@ +.lay-tooltip-content{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + cursor: pointer; +} \ No newline at end of file diff --git a/package/component/src/component/tooltip/index.vue b/package/component/src/component/tooltip/index.vue index 1772846b..bb4bf9ac 100644 --- a/package/component/src/component/tooltip/index.vue +++ b/package/component/src/component/tooltip/index.vue @@ -1,9 +1,13 @@ diff --git a/package/document/src/document/zh-CN/components/table.md b/package/document/src/document/zh-CN/components/table.md index 8b08b022..967e046c 100644 --- a/package/document/src/document/zh-CN/components/table.md +++ b/package/document/src/document/zh-CN/components/table.md @@ -39,6 +39,7 @@ export default { title:"备注", width: "180px", key:"remark", + ellipsisTooltip: true, } ] diff --git a/package/document/src/document/zh-CN/components/tooltip.md b/package/document/src/document/zh-CN/components/tooltip.md index 4d0440ce..bb8e7bec 100644 --- a/package/document/src/document/zh-CN/components/tooltip.md +++ b/package/document/src/document/zh-CN/components/tooltip.md @@ -6,6 +6,38 @@ ::: demo + + + + + +::: + +::: title 基础使用 +::: + +::: demo +