Repository: Tencent/tdesign-mobile-vue
Pull request #994 (2023-07-27 03:31:30)

fix(Tag): resolve closable invalid when disabled is true
<!--
首先，感谢你的贡献！😄
请阅读并遵循 [TDesign 贡献指南](https://github.com/Tencent/tdesign/blob/main/docs/contributing.md)，填写以下 pull request 的信息。
PR 在维护者审核通过后会合并，谢谢！
-->

### 🤔 这个 PR 的性质是？

- [ ] 日常 bug 修复
- [ ] 新特性提交
- [ ] 文档改进
- [ ] 演示代码改进
- [ ] 组件样式/交互改进
- [ ] CI/CD 改进
- [ ] 重构
- [ ] 代码风格优化
- [ ] 测试用例
- [ ] 分支合并
- [ ] 其他

### 🔗 相关 Issue

<!--
1. 描述相关需求的来源，如相关的 issue 讨论链接。
-->

### 💡 需求背景和解决方案

<!--
1. 要解决的具体问题。
2. 列出最终的 API 实现和用法。
3. 涉及UI/交互变动需要有截图或 GIF。
-->

### 📝 更新日志

<!--
从用户角度描述具体变化，以及可能的 breaking change 和其他风险。
-->

- fix(Tag): 修复当 `disabled` 为 `true` 时， `closable` 无效的问题

- [ ] 本条 PR 不需要纳入 Changelog

### ☑️ 请求合并前的自查清单

⚠️ 请自检并全部**勾选全部选项**。⚠️

- [ ] 文档已补充或无须补充
- [ ] 代码演示已提供或无须提供
- [ ] TypeScript 定义已补充或无须补充
- [ ] Changelog 已提供或无须提供


github-actions[bot]: **Size Change:** -43 B (0%) 

**Total Size:** 388 kB

| Filename | Size | Change |
| :--- | :---: | :---: |
| `./dist/tdesign.js` | 204 kB | -13 B (0%) |
| `./dist/tdesign.min.js` | 118 kB | -30 B (0%) |

<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size |
| :--- | :---: |
| `./dist/reset.css` | 672 B |
| `./dist/tdesign.css` | 37.5 kB |
| `./dist/tdesign.min.css` | 27.2 kB |

</details>


github-actions[bot]: <a href="https://preview-pr994-tdesign-mobile-vue.surge.sh"><img height="96" alt="完成" src="https://user-images.githubusercontent.com/15634204/150816437-9f5bb788-cd67-4cbc-9897-b82d74e9aa65.png" /></a>
<!-- [工作流地址](https://github.com/Tencent/tdesign-mobile-vue/actions/runs/5676259313) -->
<!-- AUTO_PREVIEW_HOOK -->

Patch:
diff --git a/site/web/app.vue b/site/web/app.vue
index 73ce82c8..4c7d16f4 100644
--- a/site/web/app.vue
+++ b/site/web/app.vue
@@ -13,7 +13,7 @@
 
 <script>
 import siteConfig from '../docs.config';
-import { sortDocs, filterVersions } from './utils';
+import { sortDocs } from './utils';
 import { defineComponent } from 'vue';
 import packageJson from '../../package.json';
 
@@ -78,9 +78,7 @@ export default defineComponent({
         .then((res) => res.json())
         .then((res) => {
           const options = [];
-          const versions = filterVersions(Object.keys(res.versions).filter((v) => !v.includes('alpha')));
-
-          versions.forEach((v) => {
+          Object.keys(res.versions).forEach((v) => {
             const nums = v.split('.');
             if (nums[0] === '0' && nums[1] < 7) return false;
 
diff --git a/src/tag/tag.vue b/src/tag/tag.vue
index 64ae1b18..7bb56f89 100644
--- a/src/tag/tag.vue
+++ b/src/tag/tag.vue
@@ -6,7 +6,7 @@
     <span :class="`${baseClass}__text`">
       <t-node :content="tagContent"></t-node>
     </span>
-    <span v-if="closable && !disabled" :class="`${baseClass}__icon-close`" @click.stop="onClickClose">
+    <span v-if="closable" :class="`${baseClass}__icon-close`" @click.stop="onClickClose">
       <close-icon />
     </span>
   </span>
@@ -56,9 +56,6 @@ const Tag = defineComponent({
 
     const onClickClose = (e: MouseEvent): void => {
       if (!props.disabled) {
-        console.log(1);
-        console.log(props.onClose);
-
         props.onClose?.({ e });
       }
     };


Test patch:
diff --git a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap
index 53abab2a..8154a502 100644
--- a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap
+++ b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap
@@ -82,6 +82,7 @@ exports[`Cascader > Cascader baseVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
@@ -312,6 +313,7 @@ exports[`Cascader > Cascader keysVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
@@ -542,6 +544,7 @@ exports[`Cascader > Cascader lazyVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
@@ -769,6 +772,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -1012,6 +1016,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -1229,6 +1234,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -1472,6 +1478,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -1715,6 +1722,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -1962,6 +1970,7 @@ exports[`Cascader > Cascader mobileVue demo works fine 1`] = `
                 class="t-icon t-icon-close"
                 fill="none"
                 height="1em"
+                style="font-size: 24px;"
                 viewBox="0 0 16 16"
                 width="1em"
               >
@@ -2161,6 +2170,7 @@ exports[`Cascader > Cascader themeTabVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
@@ -2361,6 +2371,7 @@ exports[`Cascader > Cascader withTitleVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
@@ -2595,6 +2606,7 @@ exports[`Cascader > Cascader withValueVue demo works fine 1`] = `
             class="t-icon t-icon-close"
             fill="none"
             height="1em"
+            style="font-size: 24px;"
             viewBox="0 0 16 16"
             width="1em"
           >
diff --git a/src/cascader/__test__/__snapshots__/index.test.jsx.snap b/src/cascader/__test__/__snapshots__/index.test.jsx.snap
index 7de0dc2d..f0315cba 100644
--- a/src/cascader/__test__/__snapshots__/index.test.jsx.snap
+++ b/src/cascader/__test__/__snapshots__/index.test.jsx.snap
@@ -33,6 +33,7 @@ exports[`cascader > events > : pick 1`] = `
           class="t-icon t-icon-close"
           fill="none"
           height="1em"
+          style="font-size: 24px;"
           viewBox="0 0 16 16"
           width="1em"
         >
diff --git a/src/form/__test__/__snapshots__/demo.test.jsx.snap b/src/form/__test__/__snapshots__/demo.test.jsx.snap
index d95ab641..e8fd89c2 100644
--- a/src/form/__test__/__snapshots__/demo.test.jsx.snap
+++ b/src/form/__test__/__snapshots__/demo.test.jsx.snap
@@ -859,6 +859,7 @@ exports[`Form > Form horizontalVue demo works fine 1`] = `
                     class="t-icon t-icon-close"
                     fill="none"
                     height="1em"
+                    style="font-size: 24px;"
                     viewBox="0 0 16 16"
                     width="1em"
                   >
@@ -2610,6 +2611,7 @@ exports[`Form > Form mobileVue demo works fine 1`] = `
                           class="t-icon t-icon-close"
                           fill="none"
                           height="1em"
+                          style="font-size: 24px;"
                           viewBox="0 0 16 16"
                           width="1em"
                         >
@@ -4221,6 +4223,7 @@ exports[`Form > Form verticalVue demo works fine 1`] = `
                     class="t-icon t-icon-close"
                     fill="none"
                     height="1em"
+                    style="font-size: 24px;"
                     viewBox="0 0 16 16"
                     width="1em"
                   >