docs(image): add controlled preview demo (#5234)
parent
34869eceb5
commit
d12edaea6f
|
@ -7,6 +7,18 @@ exports[`renders ./components/image/demo/basic.vue correctly 1`] = `
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`renders ./components/image/demo/controlledPreview.vue correctly 1`] = `
|
||||||
|
<div><button class="ant-btn ant-btn-primary" type="button">
|
||||||
|
<!----><span>show image preview</span>
|
||||||
|
</button>
|
||||||
|
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" style="display: none;" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png">
|
||||||
|
<!---->
|
||||||
|
<!---->
|
||||||
|
</div>
|
||||||
|
<!---->
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`renders ./components/image/demo/fallback.vue correctly 1`] = `
|
exports[`renders ./components/image/demo/fallback.vue correctly 1`] = `
|
||||||
<div class="ant-image" style="width: 200px; height: 200px;"><img class="ant-image-img" src="https://www.antdv.com/#error">
|
<div class="ant-image" style="width: 200px; height: 200px;"><img class="ant-image-img" src="https://www.antdv.com/#error">
|
||||||
<!---->
|
<!---->
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<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">
|
||||||
|
import { defineComponent, ref } from 'vue';
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const setVisible = (value): void => {
|
||||||
|
visible.value = value;
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
visible,
|
||||||
|
setVisible,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -4,6 +4,7 @@
|
||||||
<fallback />
|
<fallback />
|
||||||
<placeholder />
|
<placeholder />
|
||||||
<preview-group />
|
<preview-group />
|
||||||
|
<controlled-preview />
|
||||||
</demo-sort>
|
</demo-sort>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ import Basic from './basic.vue';
|
||||||
import Fallback from './fallback.vue';
|
import Fallback from './fallback.vue';
|
||||||
import Placeholder from './placeholder.vue';
|
import Placeholder from './placeholder.vue';
|
||||||
import PreviewGroup from './previewGroup.vue';
|
import PreviewGroup from './previewGroup.vue';
|
||||||
|
import ControlledPreview from './controlledPreview.vue';
|
||||||
|
|
||||||
import CN from '../index.zh-CN.md';
|
import CN from '../index.zh-CN.md';
|
||||||
import US from '../index.en-US.md';
|
import US from '../index.en-US.md';
|
||||||
|
@ -24,6 +26,7 @@ export default defineComponent({
|
||||||
Fallback,
|
Fallback,
|
||||||
Placeholder,
|
Placeholder,
|
||||||
PreviewGroup,
|
PreviewGroup,
|
||||||
|
ControlledPreview,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue