Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use data-* to add activation state to ULink #2726

Open
hotdogc1017 opened this issue Nov 22, 2024 · 3 comments
Open

Use data-* to add activation state to ULink #2726

hotdogc1017 opened this issue Nov 22, 2024 · 3 comments
Labels
enhancement New feature or request triage

Comments

@hotdogc1017
Copy link

hotdogc1017 commented Nov 22, 2024

For what version of Nuxt UI are you suggesting this?

v2.17.0

Description

I want to set styles for other elements based on the activation state of the ULink component, but it was unexpectedly difficult. First, I didn't find relevant content in the documentation of the ULink component. It wasn't until I found this issue that I learned that I could get the activation state through v-slot={isActive}. Secondly, I can't directly set the data-* attribute for the ULink component to save the value of isActive, because this will prompt a ts error and the rendered a tag will not contain attributes, so I have to add another HTML tag as a child element of the ULink component to indirectly add the data-* attribute.

Additional context

No response

@hotdogc1017 hotdogc1017 added enhancement New feature or request triage labels Nov 22, 2024
Copy link
Member

benjamincanac commented Nov 22, 2024

I'm confused, is this an issue for v3 or v2? You mentioned v3.0.0-alpha.x and a link to the Nuxt UI v2 docs 🤔

@hotdogc1017
Copy link
Author

I'm confused, is this an issue for v3 or v2? You mentioned v3.0.0-alpha.x and a link to the Nuxt UI v2 docs 🤔我有点困惑,这是 v3 还是 v2 的问题?你提到了v3.0.0-alpha.x,并附上了 Nuxt UI v2 文档的链接 🤔

I'm sorry, this is a v2 problem. I meant that this feature can be implemented in v3. I browsed the v3 documentation and found that it was mentioned that the activation state can be accessed using { active: boolean; }, but I didn't find the function I expected to save the activation state in the form of data-*

@hotdogc1017
Copy link
Author

I changed the version mentioned to v2.17.0, which is the version I use. But my point is still that this feature can be implemented in v3, if possible 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
Development

No branches or pull requests

2 participants