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

dropdown 的设置lay-id会覆盖原有的lay-id属性· 在tab标签上使用dropdown就会有问题 #1883

Closed
4 tasks done
fjpcliuhai opened this issue May 10, 2024 · 3 comments · Fixed by #1898
Closed
4 tasks done
Assignees
Labels
enhancement 改进或增强

Comments

@fjpcliuhai
Copy link

议题条件

  • 我确认已查看官方使用文档:https://layui.dev ,但没有找到相关解决方案。
  • 我确认已在 Issues 中搜索过类似的问题,但没有找到相关解决方案。
  • 我已仔细阅读: 🍀 Layui Issue 贡献指南

议题类型

疑是 BUG

使用版本

2.9.9

问题描述

如题

业务代码

if(!lay.isTopElem(elem[0])){
      elem.attr('lay-id',  options.id);
    }

截图补充

··

浏览器

chrome

演示地址

No response

友好承诺

  • 我承诺将本着相互尊重、理解和友善的态度进行交流,共同维护 Layui 良好的社区氛围。
@sentsim
Copy link
Member

sentsim commented May 10, 2024

related to #1761
@Sight-wcg 有待晨星评估下内部添加 lay-id 之前,是否有必要判断元素已经存在该属性,或提供一个选项用于自定义属性名,默认值 lay-id,用户可设置 false 禁用该功能。我个人比较倾向于后者。

@sentsim sentsim added the enhancement 改进或增强 label May 10, 2024
@Sight-wcg
Copy link
Collaborator

related to #1761 @Sight-wcg 有待晨星评估下内部添加 lay-id 之前,是否有必要判断元素已经存在该属性,或提供一个选项用于自定义属性名,默认值 lay-id,用户可设置 false 禁用该功能。我个人比较倾向于后者。

以组件名做命名空间如何,例如 'lay-dropdown-id', 这样不同组件使用时不会冲突,也不需要新加选项自定义。

  • lay 为 layui 使用的命名空间
  • dropdown 为组件命名空间
  • id 为组件实例的 id/index

需要将所有类似的组件做统一修改,tab 的 'lay-id' 用来标识 tab-title, 保持原样不用处理

@sentsim
Copy link
Member

sentsim commented May 10, 2024

同意 👍,这样更省事。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 改进或增强
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants