feat: 为 Curtain 组件添加 show-menu-by-longpress 和 close-on-click 属性

 Closes: #1279
This commit is contained in:
RuSheng 2025-09-09 12:46:47 +08:00 committed by GitHub
parent 98d1de8708
commit a90565510a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 5 deletions

View File

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

View File

@ -96,6 +96,8 @@ function handleClick() {
| hide-when-close | Hide popup layer when closed (display: none) | boolean | - | true | - |
| z-index | Set layer level | number | - | 10 | 1.4.0 |
| root-portal | Whether to detach from the page, used to solve various fixed positioning issues | boolean | - | false | 1.11.0 |
| 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$ |
| close-on-click | Whether clicking the image should close the curtain. Defaults to true. | boolean | - | ture | $LOWEST_VERSION$ |
## Events

View File

@ -1,8 +1,8 @@
/*
* @Author: weisheng
* @Date: 2025-01-25 23:46:29
* @LastEditTime: 2025-02-13 13:16:45
* @LastEditors: weisheng
* @LastEditTime: 2025-09-09 10:00:00
* @LastEditors: rusheng
* @Description:
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-curtain/types.ts
*
@ -68,7 +68,15 @@ export const curtainProps = {
/**
* fixed (H5: teleport, APP: renderjs, 小程序: root-portal)
*/
rootPortal: makeBooleanProp(false)
rootPortal: makeBooleanProp(false),
/**
*
*/
showMenuByLongpress: makeBooleanProp(false),
/**
* true
*/
closeOnClick: makeBooleanProp(true)
}
export type CurtainProps = ExtractPropTypes<typeof curtainProps>

View File

@ -20,7 +20,15 @@
:custom-style="customStyle"
>
<view class="wd-curtain__content">
<image :src="src" class="wd-curtain__content-img" :style="imgStyle" @click="clickImage" @error="imgErr" @load="imgLoad"></image>
<image
:src="src"
class="wd-curtain__content-img"
:style="imgStyle"
:show-menu-by-longpress="showMenuByLongpress"
@click="clickImage"
@error="imgErr"
@load="imgLoad"
></image>
<slot name="close">
<wd-icon
name="close-outline"
@ -153,7 +161,9 @@ function clickImage() {
})
}
emit('click')
close()
if (props.closeOnClick) {
close()
}
}
</script>