From ea1693dd329b1fd0146ea6130743ff1c66496a59 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Mon, 3 Jun 2024 22:12:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(tab):=20=E5=A2=9E=E5=BC=BA=20tab=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20(#1955)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(tab): 增强 tab 功能 1. lay-allowclose="false" 可以添加到 tab 容器或 tab title 元素上,遵循就近原则。 - 添加到 tab 容器时,控制所有选项卡是否允许关闭, - 添加到 tab title 元素时,控制单个选项卡是否允许关闭。 - tabAdd 参数新增 allowclose 选项,效果同 tab title 元素上的 lay-allowclose 属性 2. 当 tab title 元素上有 lay-id 属性时,将根据 id 显示/删除对应的 content 元素,方便实现拖拽选项卡 3. 新增 tabBeforeDelete 事件,返回 false 时阻止关闭对应的选项卡 4. 因为 2,事件参数新增 id 属性 * refactor: 移除 title 和 content 同步 id,改为如果 content 中找不到 id, 就回退到默认行为 * docs(tab): 更新 tab 文档 * docs(tab): 优化文案 * style(tab): 避免某些分辨率下默认风格的当前选中标签头出现下边框的问题 * docs(tab): 优化文档及示例细节 --------- Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com> --- docs/tab/index.md | 35 +++++++++++++++++++++++++++++++---- src/css/layui.css | 2 +- src/modules/element.js | 38 +++++++++++++++++++++++++++++++------- 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/docs/tab/index.md b/docs/tab/index.md index 44b4a168..e97e7850 100644 --- a/docs/tab/index.md +++ b/docs/tab/index.md @@ -118,8 +118,8 @@ tab 组件提供了三种 UI 风格,分别为: | 属性 | 描述 | | --- | --- | -| lay-allowclose | 是否开启删除图标。设置在 tab 容器 `