From 5d686335535b1a6411c7e6b9a48b5b4e6163af51 Mon Sep 17 00:00:00 2001
From: shenjunjian <40288193@qq.com>
Date: Mon, 24 Nov 2025 11:18:42 +0800
Subject: [PATCH 1/2] fix(auto-tip): add popperClass for AutoTip directive
---
.../app/directives/webdoc/directives-auto-tip.js | 2 ++
packages/vue-directive/src/auto-tip.ts | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js b/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
index 86b7b2ad4c..0016144d23 100644
--- a/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
+++ b/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
@@ -42,6 +42,7 @@ export default {
content属性,指定提示的内容,支持传入string,VNode 或VNode 数组。不传入值时,使用当前Dom元素的内容。
effect 属性,指定提示的效果,支持 light 和 dark ,默认是light亮色主题
placement 属性,指定提示的位置,默认值为top 。参见tooltip 组件的placement 属性。
+ popperClass 属性,设置弹出层的class 。参见tooltip 组件的popperClass 属性。
2、如果参数为 false,表示禁止自动提示。
`,
@@ -53,6 +54,7 @@ export default {
content property specifies the content of the prompt, which can be passed to string, VNode, or the VNode array . When no value is passed, the contents of the current Dom element are used.
effect property, specify the effect of the prompt, support light and dark, default is light bright color theme
placement property specifies the placement of the tip. The default value is top. See the placement property of the tooltip component.
+ popperClass attribute, sets the class of the pop-up layer. See tooltip component's popperClass attribute.
2. If the parameter is false, the automatic prompt is disabled.
`
diff --git a/packages/vue-directive/src/auto-tip.ts b/packages/vue-directive/src/auto-tip.ts
index 1313ca3c29..7e4f3b1dff 100644
--- a/packages/vue-directive/src/auto-tip.ts
+++ b/packages/vue-directive/src/auto-tip.ts
@@ -18,6 +18,7 @@ interface TooltipDirectiveConfig {
content?: string // 自定义提示内容, 支持字符串或 VNode | VNode[], 不支持嵌套的 html 标签
effect?: 'dark' | 'light' // tooltip主题,默认为light
placement?: string
+ popperClass?: string
}
// 高度计算最多可以允许的误差,修复checkbox的tip提示一直显示的bug(scrollHeight:15,clientHeight:14)
@@ -55,6 +56,12 @@ const isDarkTheme = (currentTarget) => Boolean(currentTarget?.boundingValue?.eff
const getPlacement = (currentTarget) => currentTarget.boundingValue?.placement || 'top'
+let oldPopperClass: string[] = []
+const getPopperClass = (currentTarget) => {
+ const cls: string = currentTarget.boundingValue?.popperClass || ''
+ return cls.split(' ').filter((c) => c)
+}
+
const mouseenterHandler = (e) => {
const currentTarget = e.currentTarget
@@ -73,10 +80,13 @@ const mouseenterHandler = (e) => {
propsData: {
renderContent: () => h('span', { class: 'tiny-directive-tip__content' }, tooltipContent.value),
placement: getPlacement(currentTarget),
- effect: isDarkTheme(currentTarget) ? 'dark' : 'light'
+ effect: isDarkTheme(currentTarget) ? 'dark' : 'light',
+ popperClass: getPopperClass(currentTarget).join(' ')
},
component: Tooltip
})
+
+ oldPopperClass = getPopperClass(currentTarget)
}
const tooltip = globalTooltip.value
@@ -91,6 +101,9 @@ const mouseenterHandler = (e) => {
`is-${isDarkTheme(currentTarget) ? 'light' : 'dark'}`,
`is-${isDarkTheme(currentTarget) ? 'dark' : 'light'}`
)
+ popperElm.classList.remove(...oldPopperClass)
+ oldPopperClass = getPopperClass(currentTarget)
+ popperElm.classList.add(...oldPopperClass)
}
tooltip.show()
From d60cee596483c905c2dee016de0a559eeccc1b8f Mon Sep 17 00:00:00 2001
From: shenjunjian <40288193@qq.com>
Date: Mon, 24 Nov 2025 17:17:09 +0800
Subject: [PATCH 2/2] fix(docs): add version infomation
---
.../sites/demos/pc/app/directives/webdoc/directives-auto-tip.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js b/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
index 0016144d23..d19139fc10 100644
--- a/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
+++ b/examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
@@ -42,7 +42,7 @@ export default {
content属性,指定提示的内容,支持传入string,VNode 或VNode 数组。不传入值时,使用当前Dom元素的内容。
effect 属性,指定提示的效果,支持 light 和 dark ,默认是light亮色主题
placement 属性,指定提示的位置,默认值为top 。参见tooltip 组件的placement 属性。
- popperClass 属性,设置弹出层的class 。参见tooltip 组件的popperClass 属性。
+ popperClass 属性,设置弹出层的class,该属性在3.28 版本引入 。参见tooltip 组件的popperClass 属性。
2、如果参数为 false,表示禁止自动提示。
`,