vuecssuiant-designantdreactantantd-vueenterprisefrontendui-designvue-antdvue-antd-uivue3vuecomponent
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
714 B
39 lines
714 B
<docs> |
|
--- |
|
order: 4 |
|
title: |
|
zh-CN: 受控的预览 |
|
en-US: Controlled Preview |
|
--- |
|
|
|
## zh-CN |
|
|
|
可以使预览受控。 |
|
|
|
## en-US |
|
|
|
You can make preview controlled. |
|
|
|
</docs> |
|
|
|
<template> |
|
<div> |
|
<a-button type="primary" @click="() => setVisible(true)">show image preview</a-button> |
|
<a-image |
|
:width="200" |
|
:style="{ display: 'none' }" |
|
:preview="{ |
|
visible, |
|
onVisibleChange: setVisible, |
|
}" |
|
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" |
|
/> |
|
</div> |
|
</template> |
|
<script lang="ts" setup> |
|
import { ref } from 'vue'; |
|
const visible = ref<boolean>(false); |
|
const setVisible = (value): void => { |
|
visible.value = value; |
|
}; |
|
</script>
|
|
|