Skip to content

Curtain ​

Generally used for announcement-type image popups.

Basic Usage ​

Set display and hide through the v-model property, which is required.

src is the curtain image URL (only online URLs are supported), value type is string, required.

to is the link to visit when clicking the curtain, value type is string, optional.

html
<wd-button @click="handleClick">Show Curtain</wd-button>
<wd-curtain v-model="value" :src="img" :to="link"></wd-curtain>
typescript
const value = ref<boolean>(false)
const img = ref<string>('https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png')
const link = ref<string>('/pages/index/index')

function handleClick() {
  value.value = true
}

Set Curtain Image Width and Height ​

Set width, the default height is calculated based on the original image ratio and the input width, required.

html
<wd-button @click="handleClick">Show Curtain</wd-button>
<wd-curtain v-model="value" :src="img" :to="link" width="280"></wd-curtain>
typescript
const value = ref<boolean>(false)
const img = ref<string>('https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png')
const link = ref<string>('/pages/index/index')

function handleClick() {
  value.value = true
}

Modify Close Button Position ​

Set close-position, default is 'inset', available values are 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', 'bottom-right'.

html
<wd-button @click="handleClick">Show Curtain</wd-button>
<wd-curtain v-model="value" :src="img" :to="link" close-position="top" width="280"></wd-curtain>
typescript
const value = ref<boolean>(false)
const img = ref<string>('https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png')
const link = ref<string>('/pages/index/index')

function handleClick() {
  value.value = true
}

Set Mask Click to Close Curtain ​

Set the close-on-click-modal property, value type is boolean, optional.

html
<wd-button @click="handleClick">Show Curtain</wd-button>
<wd-curtain v-model="value" :src="img" :to="link" close-position="bottom-right" width="280" close-on-click-modal></wd-curtain>
typescript
const value = ref<boolean>(false)
const img = ref<string>('https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png')
const link = ref<string>('/pages/index/index')

function handleClick() {
  value.value = true
}

Attributes ​

ParameterDescriptionTypeOptionsDefaultVersion
valueBinding value, show/hide curtain (deprecated, use modelValue)boolean---
modelValueBinding value, show/hide curtainboolean--1.7.0
srcCurtain image URL, must use online URLstring---
widthCurtain image width, default unit pxnumber---
toCurtain image click linkstring---
close-positionClose button positionstringinset / top / bottom / top-left / top-right / bottom-left / bottom-rightinset-
close-on-click-modalClose on mask clickboolean-false-
hide-when-closeHide popup layer when closed (display: none)boolean-true-
z-indexSet layer levelnumber-101.4.0
root-portalWhether to detach from the page, used to solve various fixed positioning issuesboolean-false1.11.0
show-menu-by-longpressEnable long press image to show Mini Program code recognition menu, only supported in WeChat Mini Programboolean-false1.13.0
close-on-clickWhether clicking the image should close the curtain. Defaults to true.boolean-ture1.13.0

Events ​

Event NameDescriptionParametersVersion
clickTriggered when clicking the curtain--
closeTriggered when popup layer closes--
click-modalTriggered when clicking the mask--
beforeenterTriggered before enter--
enterTriggered during enter--
afterenterTriggered after enter--
beforeleaveTriggered before leave--
leaveTriggered during leave--
afterleaveTriggered after leave--
loadImage load complete event--
errorImage load failure event, if image fails to load, curtain component won't show even if value is true--

Slots ​

NameDescriptionVersion
closeClose button slot1.5.0

External Classes ​

Class NameDescriptionVersion
custom-classRoot node style-
custom-close-classClose button style1.5.0
custom-close-styleClose button style1.5.0

Source Code ​

Documentation
• Component

Released under the MIT License.

Released under the MIT License.