Skip to content

Curtain

Generally used for announcement image popup display.

Component Type

Basic Usage

Control display and hide through v-model; src is the curtain image address; to is the jump link after clicking the image; width is the image width (height is automatically calculated according to original image ratio).

html
<wd-button @click="open = true">Show Curtain</wd-button>
<wd-curtain v-model="open" :src="img" :to="link" :width="280" />

Component Style

Modify Close Button Position

close-position optional values are inset, top, bottom, top-left, top-right, bottom-left, bottom-right.

html
<wd-curtain v-model="showTopLeft" :src="img" :to="link" close-position="top-left" :width="280" />
<wd-curtain v-model="showTop" :src="img" :to="link" close-position="top" :width="280" />
<wd-curtain v-model="showTopRight" :src="img" :to="link" close-position="top-right" :width="280" />

Component State

Click Mask to Close

Set close-on-click-modal, clicking mask will close curtain.

html
<wd-curtain v-model="open" :src="img" :to="link" close-position="bottom-right" :width="280" close-on-click-modal />

Special Style

Custom Close Button

Customize close button content and interaction through close slot.

html
<wd-curtain v-model="open" :src="img" :width="280">
  <template #close>
    <view class="custom-close" @click="open = false">Close</view>
  </template>
</wd-curtain>

Attributes

ParameterDescriptionTypeDefault Value
v-model / modelValue v1.7.0Binding value, controls curtain display and closebooleanfalse
valueBinding value (deprecated, please use modelValue)booleanfalse
srcCurtain image address, must use network addressstring-
widthCurtain image width, default unit pxnumber-
toCurtain image click linkstring-
close-positionClose button position, optional values are inset, top, bottom, top-left, top-right, bottom-left, bottom-rightstringinset
close-on-click-modalWhether to close when clicking maskbooleanfalse
hide-when-closeWhether to hide popup when closing (display: none)booleantrue
z-index v1.4.0Set z-indexnumber10
custom-close-class v1.5.0Close button custom class namestring''
custom-close-style v1.5.0Close button custom stylestring''
root-portal v1.11.0Whether to detach from page, used to solve fixed invalidation problem (H5: teleport, App: renderjs, Mini Program: root-portal)booleanfalse
show-menu-by-longpress v1.13.0Enable long press image to show recognition mini program code menu, only WeChat Mini Program supportsbooleanfalse
close-on-click v1.13.0Whether to close curtain when clicking imagebooleantrue
custom-classRoot node custom class namestring''
custom-styleRoot node custom stylestring''

Events

Event NameDescriptionParameters
clickTriggered when clicking curtain image-
closeTriggered when popup closes-
closedTriggered when popup close animation ends-
click-modalTriggered when clicking mask-
beforeenterTriggered before entering-
enterTriggered when entering-
afterenterTriggered after entering-
beforeleaveTriggered before leaving-
leaveTriggered when leaving-
afterleaveTriggered after leaving-
loadTriggered when image loadsevent
errorTriggered when image load fails. Even if modelValue is true, curtain will not display after image load fails-

Slots

nameDescriptionParameters
close v1.5.0Custom close button-

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-curtain-content-radius$radius-large幕帘内容圆角
--wot-curtain-content-close-color$text-white幕帘关闭图标颜色
--wot-curtain-content-close-size$n-32幕帘关闭图标尺寸
--wot-curtain-content-close-inset$spacing-extra-loose幕帘关闭图标偏移

Source Code

Documentation
Component

Released under the MIT License.

Released under the MIT License.