mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-23 23:19:15 +08:00
feat(ImagePreview): add overlay-style prop (#8276)
This commit is contained in:
parent
42d1e9430c
commit
e50cd0c731
@ -1,7 +1,20 @@
|
|||||||
import { ref, watch, nextTick, onMounted, PropType, reactive } from 'vue';
|
import {
|
||||||
|
ref,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
PropType,
|
||||||
|
reactive,
|
||||||
|
onMounted,
|
||||||
|
CSSProperties,
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { ComponentInstance, UnknownProp, createNamespace } from '../utils';
|
import {
|
||||||
|
pick,
|
||||||
|
UnknownProp,
|
||||||
|
createNamespace,
|
||||||
|
ComponentInstance,
|
||||||
|
} from '../utils';
|
||||||
import { callInterceptor, Interceptor } from '../utils/interceptor';
|
import { callInterceptor, Interceptor } from '../utils/interceptor';
|
||||||
|
|
||||||
// Composables
|
// Composables
|
||||||
@ -28,6 +41,7 @@ export default createComponent({
|
|||||||
transition: String,
|
transition: String,
|
||||||
className: UnknownProp,
|
className: UnknownProp,
|
||||||
beforeClose: Function as PropType<Interceptor>,
|
beforeClose: Function as PropType<Interceptor>,
|
||||||
|
overlayStyle: Object as PropType<CSSProperties>,
|
||||||
showIndicators: Boolean,
|
showIndicators: Boolean,
|
||||||
images: {
|
images: {
|
||||||
type: Array as PropType<string[]>,
|
type: Array as PropType<string[]>,
|
||||||
@ -217,13 +231,18 @@ export default createComponent({
|
|||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<Popup
|
<Popup
|
||||||
show={props.show}
|
|
||||||
class={[bem(), props.className]}
|
class={[bem(), props.className]}
|
||||||
transition={props.transition}
|
|
||||||
overlayClass={bem('overlay')}
|
overlayClass={bem('overlay')}
|
||||||
closeOnPopstate={props.closeOnPopstate}
|
|
||||||
onClosed={onClosed}
|
onClosed={onClosed}
|
||||||
{...{ 'onUpdate:show': updateShow }}
|
{...{
|
||||||
|
...pick(props, [
|
||||||
|
'show',
|
||||||
|
'transition',
|
||||||
|
'overlayStyle',
|
||||||
|
'closeOnPopstate',
|
||||||
|
]),
|
||||||
|
'onUpdate:show': updateShow,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{renderClose()}
|
{renderClose()}
|
||||||
{renderImages()}
|
{renderImages()}
|
||||||
|
@ -140,6 +140,7 @@ export default {
|
|||||||
| closeIcon | Close icon name | _string_ | `clear` |
|
| closeIcon | Close icon name | _string_ | `clear` |
|
||||||
| closeIconPosition | Close icon position,can be set to `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
| closeIconPosition | Close icon position,can be set to `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
||||||
| transition `v3.0.8` | Transition, equivalent to `name` prop of [transtion](https://v3.vuejs.org/api/built-in-components.html#transition) | _string_ | `van-fade` |
|
| transition `v3.0.8` | Transition, equivalent to `name` prop of [transtion](https://v3.vuejs.org/api/built-in-components.html#transition) | _string_ | `van-fade` |
|
||||||
|
| overlay-style `v3.0.8` | Custom overlay style | _object_ | - |
|
||||||
| teleport | Return the mount node for ImagePreview | _string \| Element_ | - |
|
| teleport | Return the mount node for ImagePreview | _string \| Element_ | - |
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
@ -161,6 +162,7 @@ export default {
|
|||||||
| close-icon | Close icon name | _string_ | `clear` |
|
| close-icon | Close icon name | _string_ | `clear` |
|
||||||
| close-icon-position | Close icon position,can be set to `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
| close-icon-position | Close icon position,can be set to `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
||||||
| transition `v3.0.8` | Transition, equivalent to `name` prop of [transtion](https://v3.vuejs.org/api/built-in-components.html#transition) | _string_ | `van-fade` |
|
| transition `v3.0.8` | Transition, equivalent to `name` prop of [transtion](https://v3.vuejs.org/api/built-in-components.html#transition) | _string_ | `van-fade` |
|
||||||
|
| overlay-style `v3.0.8` | Custom overlay style | _object_ | - |
|
||||||
| teleport | Return the mount node for ImagePreview | _string \| Element_ | - |
|
| teleport | Return the mount node for ImagePreview | _string \| Element_ | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
@ -176,7 +176,8 @@ export default {
|
|||||||
| closeable | 是否显示关闭图标 | _boolean_ | `false` |
|
| closeable | 是否显示关闭图标 | _boolean_ | `false` |
|
||||||
| closeIcon | 关闭图标名称或图片链接 | _string_ | `clear` |
|
| closeIcon | 关闭图标名称或图片链接 | _string_ | `clear` |
|
||||||
| closeIconPosition | 关闭图标位置,可选值为 `top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` |
|
| closeIconPosition | 关闭图标位置,可选值为 `top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` |
|
||||||
| transition | 动画类名,等价于 [transtion](https://v3.cn.vuejs.org/api/built-in-components.html#transition) 的 `name` 属性 | _string_ | `van-fade` |
|
| transition `v3.0.8` | 动画类名,等价于 [transtion](https://v3.cn.vuejs.org/api/built-in-components.html#transition) 的 `name` 属性 | _string_ | `van-fade` |
|
||||||
|
| overlay-style `v3.0.8` | 自定义遮罩层样式 | _object_ | - |
|
||||||
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
@ -199,8 +200,9 @@ export default {
|
|||||||
| closeable | 是否显示关闭图标 | _boolean_ | `false` |
|
| closeable | 是否显示关闭图标 | _boolean_ | `false` |
|
||||||
| close-icon | 关闭图标名称或图片链接 | _string_ | `clear` |
|
| close-icon | 关闭图标名称或图片链接 | _string_ | `clear` |
|
||||||
| close-icon-position | 关闭图标位置,可选值为 `top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` |
|
| close-icon-position | 关闭图标位置,可选值为 `top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` |
|
||||||
| transition | 动画类名,等价于 [transtion](https://v3.cn.vuejs.org/api/built-in-components.html#transition) 的 `name` 属性 | _string_ | `van-fade` |
|
| transition `v3.0.8` | 动画类名,等价于 [transtion](https://v3.cn.vuejs.org/api/built-in-components.html#transition) 的 `name` 属性 | _string_ | `van-fade` |
|
||||||
| teleport `v3.0.8` | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
| overlay-style `v3.0.8` | 自定义遮罩层样式 | _object_ | - |
|
||||||
|
| teleport | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| Element_ | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { App, Plugin, TeleportProps } from 'vue';
|
import { App, CSSProperties, Plugin, TeleportProps } from 'vue';
|
||||||
import { ComponentInstance, inBrowser } from '../utils';
|
import { ComponentInstance, inBrowser } from '../utils';
|
||||||
import { mountComponent, usePopupState } from '../utils/mount-component';
|
import { mountComponent, usePopupState } from '../utils/mount-component';
|
||||||
import { Interceptor } from '../utils/interceptor';
|
import { Interceptor } from '../utils/interceptor';
|
||||||
@ -19,6 +19,7 @@ export type ImagePreviewOptions = {
|
|||||||
closeIcon?: string;
|
closeIcon?: string;
|
||||||
transition?: string;
|
transition?: string;
|
||||||
beforeClose?: Interceptor;
|
beforeClose?: Interceptor;
|
||||||
|
overlayStyle?: CSSProperties;
|
||||||
swipeDuration?: number;
|
swipeDuration?: number;
|
||||||
startPosition?: number;
|
startPosition?: number;
|
||||||
showIndicators?: boolean;
|
showIndicators?: boolean;
|
||||||
@ -44,6 +45,7 @@ const defaultConfig: ImagePreviewOptions = {
|
|||||||
closeIcon: 'clear',
|
closeIcon: 'clear',
|
||||||
transition: undefined,
|
transition: undefined,
|
||||||
beforeClose: undefined,
|
beforeClose: undefined,
|
||||||
|
overlayStyle: undefined,
|
||||||
startPosition: 0,
|
startPosition: 0,
|
||||||
swipeDuration: 300,
|
swipeDuration: 300,
|
||||||
showIndicators: false,
|
showIndicators: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user