Repository: ant-design/ant-design-mobile
Pull request #6330 (2023-08-22 02:00:22)

fix: (WaterMark) when not set zIndex props, --adm-water-mark-z-index …
fix: #6329 

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/ant-design/ant-design-mobile/pull/6330?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design) Report
Patch coverage: **`100.00%`** and no project coverage change.
> Comparison is base [(`8a3f426`)](https://app.codecov.io/gh/ant-design/ant-design-mobile/commit/8a3f426aadb07b4f3d9727f7db569cba88763dbf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design) 91.56% compared to head [(`8c496b8`)](https://app.codecov.io/gh/ant-design/ant-design-mobile/pull/6330?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design) 91.56%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #6330   +/-   ##
=======================================
  Coverage   91.56%   91.56%           
=======================================
  Files         306      306           
  Lines        6592     6592           
  Branches     1627     1627           
=======================================
  Hits         6036     6036           
  Misses        521      521           
  Partials       35       35           
```


| [Files Changed](https://app.codecov.io/gh/ant-design/ant-design-mobile/pull/6330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design) | Coverage Δ | |
|---|---|---|
| [src/components/water-mark/water-mark.tsx](https://app.codecov.io/gh/ant-design/ant-design-mobile/pull/6330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design#diff-c3JjL2NvbXBvbmVudHMvd2F0ZXItbWFyay93YXRlci1tYXJrLnRzeA==) | `100.00% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/ant-design/ant-design-mobile/pull/6330?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ant-design).

github-actions[bot]: PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6330.surge.sh
liangskyli: 是的，我把它去掉吧，可以不对外暴露





------------------ Original ------------------
From: Wing ***@***.***&gt;
Date: Tue,Aug 22,2023 11:19 PM
To: ant-design/ant-design-mobile ***@***.***&gt;
Cc: liangsky ***@***.***&gt;, Author ***@***.***&gt;
Subject: Re: [ant-design/ant-design-mobile] fix: (WaterMark) when not set zIndex props, --adm-water-mark-z-index … (PR #6330)





 
@1587315093 commented on this pull request.
 
 
In src/components/water-mark/water-mark.tsx:
 &gt; @@ -8,7 +8,7 @@ const classPrefix = `adm-water-mark`  export type WaterMarkProps = {    gapX?: number    gapY?: number -  zIndex?: number +  zIndex?: number | 'var(--z-index)'  
这个类型提示也没用  就是写死的str
 
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***&gt;
liangskyli: 这样是可以，之前没这样写，css var 里已经有默认值了，也是2000，一样的，我改了

------------------ Original ------------------
From: 二货爱吃白萝卜 ***@***.***&gt;
Date: Thu,Aug 24,2023 8:07 PM
To: ant-design/ant-design-mobile ***@***.***&gt;
Cc: liangsky ***@***.***&gt;, Author ***@***.***&gt;
Subject: Re: [ant-design/ant-design-mobile] fix: (WaterMark) when not set zIndex props, --adm-water-mark-z-index … (PR #6330)





 
@zombieJ commented on this pull request.
 
 
In src/components/water-mark/water-mark.tsx:
 &gt; @@ -31,7 +31,7 @@ const defaultProps = {  export const WaterMark: FC<WaterMarkProps&gt; = p =&gt; {    const props = mergeProps(defaultProps, p)    const { -    zIndex = 2000, +    zIndex = 'var(--z-index)',  
可以这样，css var 里改成和 zIndex prop 一样。然后 zIndex prop 默认为空
 
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***&gt;

Patch:
diff --git a/src/components/water-mark/water-mark.tsx b/src/components/water-mark/water-mark.tsx
index 2733e8804..e97b5ba40 100644
--- a/src/components/water-mark/water-mark.tsx
+++ b/src/components/water-mark/water-mark.tsx
@@ -31,7 +31,7 @@ const defaultProps = {
 export const WaterMark: FC<WaterMarkProps> = p => {
   const props = mergeProps(defaultProps, p)
   const {
-    zIndex = 2000,
+    zIndex,
     gapX = 24,
     gapY = 48,
     width = 120,


Test patch:
diff --git a/src/components/water-mark/tests/__snapshots__/water-mark.test.tsx.snap b/src/components/water-mark/tests/__snapshots__/water-mark.test.tsx.snap
index cd70dd038..a1c1c27ed 100644
--- a/src/components/water-mark/tests/__snapshots__/water-mark.test.tsx.snap
+++ b/src/components/water-mark/tests/__snapshots__/water-mark.test.tsx.snap
@@ -4,7 +4,7 @@ exports[`WaterMark content watermark 1`] = `
 <div>
   <div
     class="adm-water-mark adm-water-mark-full-page"
-    style="z-index: 2000; background-size: 144px; background-image: url(data:image/png;base64,00);"
+    style="background-size: 144px; background-image: url(data:image/png;base64,00);"
   />
 </div>
 `;
@@ -13,7 +13,7 @@ exports[`WaterMark image watermark 1`] = `
 <div>
   <div
     class="adm-water-mark adm-water-mark-full-page"
-    style="z-index: 2000; background-size: 144px; background-image: url(data:image/png;base64,00);"
+    style="background-size: 144px; background-image: url(data:image/png;base64,00);"
   />
 </div>
 `;
@@ -22,7 +22,7 @@ exports[`WaterMark more rows content watermark 1`] = `
 <div>
   <div
     class="adm-water-mark adm-water-mark-full-page"
-    style="z-index: 2000; background-size: 144px; background-image: url(data:image/png;base64,00);"
+    style="background-size: 144px; background-image: url(data:image/png;base64,00);"
   />
 </div>
 `;