Skip to content

Conversation

@shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Nov 24, 2025

PR

auto-tip指令,添加 popperClass的属性。 发包81

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Added a popperClass option for the v-auto-tip directive so tooltips can receive custom CSS classes and update those classes dynamically when shown.
  • Documentation

    • Updated v-auto-tip directive docs in Chinese and English to describe the new popperClass attribute.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the bug Something isn't working label Nov 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Adds an optional popperClass config to the v-auto-tip directive and implements runtime parsing, caching, removal, and re-application of custom CSS classes on the popper element; also updates example docs to document the new attribute. (≤50 words)

Changes

Cohort / File(s) Summary
Documentation
examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
Added zh-CN and en-US descriptions documenting the new popperClass attribute for the v-auto-tip directive.
Directive implementation
packages/vue-directive/src/auto-tip.ts
Added popperClass?: string to TooltipDirectiveConfig; introduced oldPopperClass state and getPopperClass() helper; pass popperClass in tooltip propsData; remove old classes and apply updated classes on each display/update.

Sequence Diagram(s)

sequenceDiagram
    participant Config as Directive Config
    participant Directive as v-auto-tip Directive
    participant Tooltip as Tooltip Component
    participant Popper as Popper (DOM)

    Config->>Directive: provide popperClass (string)
    Directive->>Tooltip: create Tooltip (propsData includes popperClass)
    Tooltip->>Popper: render with initial classes
    Directive->>Directive: cache classes -> oldPopperClass

    Note over Directive,Popper: On subsequent show/update
    Directive->>Popper: remove classes in oldPopperClass
    Directive->>Directive: getPopperClass(currentTarget) -> newClasses
    Directive->>Directive: update oldPopperClass = newClasses
    Directive->>Popper: add newClasses
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Attention areas:
    • Correctness of getPopperClass() parsing and filtering logic (edge cases: empty strings, extra spaces).
    • Proper synchronization between tooltip lifecycle and class application/removal to avoid stale references or missed updates.
    • Ensure oldPopperClass uses arrays and DOM classList operations robustly (avoid duplicates).
    • Compatibility between propsData.popperClass format and Tooltip component expectations.

Poem

🐰 I hop and nibble at classes new,
I split, I cache, then stitch them true.
Old stripes removed, fresh coats applied,
Tooltips prance with style and pride,
A little hop for every view. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a popperClass feature to the AutoTip directive.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shen/auto-tip-add-popperClass

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d68633 and d60cee5.

📒 Files selected for processing (1)
  • examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/sites/demos/pc/app/directives/webdoc/directives-auto-tip.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

<li><code>content</code>属性,指定提示的内容,支持传入<code>string</code>,<code>VNode</code> 或<code>VNode 数组</code>。不传入值时,使用当前<code>Dom</code>元素的内容。 </li>
<li><code>effect</code> 属性,指定提示的效果,支持 <code>light</code> 和 <code>dark</code> ,默认是<code>light</code>亮色主题 </li>
<li><code>placement</code> 属性,指定提示的位置,默认值为<code>top</code> 。参见<code>tooltip</code> 组件的<code>placement</code> 属性。 </li>
<li><code>popperClass</code> 属性,设置弹出层的class 。参见<code>tooltip</code> 组件的<code>popperClass</code> 属性。 </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要标注下是什么版本添加的此特性

@zzcr zzcr merged commit f0be5f5 into dev Nov 24, 2025
9 of 10 checks passed
@zzcr zzcr deleted the shen/auto-tip-add-popperClass branch November 24, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants