Skip to content

Commit a905655

Browse files
authored
feat: ✨ 为 Curtain 组件添加 show-menu-by-longpress 和 close-on-click 属性
✅ Closes: #1279
1 parent 98d1de8 commit a905655

4 files changed

Lines changed: 27 additions & 5 deletions

File tree

‎docs/component/curtain.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ function handleClick() {
9696
| hide-when-close | 是否当关闭时将弹出层隐藏(display: none) | boolean | - | true | - |
9797
| z-index | 设置层级 | number | - | 10 | 1.4.0 |
9898
| root-portal | 是否从页面中脱离出来,用于解决各种 fixed 失效问题 | boolean | - | false | 1.11.0 |
99+
| show-menu-by-longpress | 开启长按图片显示识别小程序码菜单,仅微信小程序支持 | boolean | - | false | $LOWEST_VERSION$ |
100+
| close-on-click | 是否在点击图片时关闭幕帘,默认为 true | boolean | - | ture | $LOWEST_VERSION$ |
99101

100102
## Events
101103

‎docs/en-US/component/curtain.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ function handleClick() {
9696
| hide-when-close | Hide popup layer when closed (display: none) | boolean | - | true | - |
9797
| z-index | Set layer level | number | - | 10 | 1.4.0 |
9898
| root-portal | Whether to detach from the page, used to solve various fixed positioning issues | boolean | - | false | 1.11.0 |
99+
| show-menu-by-longpress | Enable long press image to show Mini Program code recognition menu, only supported in WeChat Mini Program | boolean | - | false | $LOWEST_VERSION$ |
100+
| close-on-click | Whether clicking the image should close the curtain. Defaults to true. | boolean | - | ture | $LOWEST_VERSION$ |
99101

100102
## Events
101103

‎src/uni_modules/wot-design-uni/components/wd-curtain/types.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2025-01-25 23:46:29
4-
* @LastEditTime: 2025-02-13 13:16:45
5-
* @LastEditors: weisheng
4+
* @LastEditTime: 2025-09-09 10:00:00
5+
* @LastEditors: rusheng
66
* @Description:
77
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-curtain/types.ts
88
* 记得注释
@@ -68,7 +68,15 @@ export const curtainProps = {
6868
/**
6969
* 是否从页面中脱离出来,用于解决各种 fixed 失效问题 (H5: teleport, APP: renderjs, 小程序: root-portal)
7070
*/
71-
rootPortal: makeBooleanProp(false)
71+
rootPortal: makeBooleanProp(false),
72+
/**
73+
* 开启长按图片显示识别小程序码菜单,仅在微信小程序平台有效
74+
*/
75+
showMenuByLongpress: makeBooleanProp(false),
76+
/**
77+
* 点击图片是否关闭幕帘,默认为 true
78+
*/
79+
closeOnClick: makeBooleanProp(true)
7280
}
7381

7482
export type CurtainProps = ExtractPropTypes<typeof curtainProps>

‎src/uni_modules/wot-design-uni/components/wd-curtain/wd-curtain.vue‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@
2020
:custom-style="customStyle"
2121
>
2222
<view class="wd-curtain__content">
23-
<image :src="src" class="wd-curtain__content-img" :style="imgStyle" @click="clickImage" @error="imgErr" @load="imgLoad"></image>
23+
<image
24+
:src="src"
25+
class="wd-curtain__content-img"
26+
:style="imgStyle"
27+
:show-menu-by-longpress="showMenuByLongpress"
28+
@click="clickImage"
29+
@error="imgErr"
30+
@load="imgLoad"
31+
></image>
2432
<slot name="close">
2533
<wd-icon
2634
name="close-outline"
@@ -153,7 +161,9 @@ function clickImage() {
153161
})
154162
}
155163
emit('click')
156-
close()
164+
if (props.closeOnClick) {
165+
close()
166+
}
157167
}
158168
</script>
159169

0 commit comments

Comments
 (0)