UNPKG

4.24 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps, CommonEventFunction } from './common'
3interface CoverImageProps extends StandardProps {
4 /** 图标路径,支持临时路径、网络地址、云文件ID。暂不支持base64格式。
5 * @supported weapp, alipay, swan, qq, jd, h5
6 */
7 src: string
8 /** 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本;
9 * @supported weapp
10 */
11 referrerPolicy?: 'origin' | 'no-referrer'
12 /** 设置与容器顶部的固定距离,效果相当于在 CSS 中设置 position: fixed 和 top 值,该属性优先级高于 fixed-bottom,CSS 设置的 position、top、bottom 值
13 * @supported swan
14 */
15 fixedTop?: string
16 /** 设置与容器右侧的固定距离,效果相当于在 CSS 中设置 position: fixed 和 right 值,该属性优先级高于 CSS 设置的 position、left、right 值
17 * @supported swan
18 */
19 fixedRight?: string
20 /** 设置与容器底部的固定距离,效果相当于在 CSS 中设置 position: fixed 和 bottom 值,该属性优先级高于 CSS 设置的 position、top、bottom 值
21 * @supported swan
22 */
23 fixedBottom?: string
24 /** 设置与容器左侧的固定距离,效果相当于在 CSS 中设置 position: fixed 和 left 值,该属性优先级高于 fixed-right,CSS 设置的 position、left、right 值
25 * @supported swan
26 */
27 fixedLeft?: string
28 /** 无障碍访问,(角色)标识元素的作用
29 * @supported qq
30 */
31 ariaRole?: string
32 /** 无障碍访问,(属性)元素的额外描述
33 * @supported qq
34 */
35 ariaLabel?: string
36 /** 图片加载成功时触发
37 * @supported weapp, swan, qq, jd, h5
38 */
39 onLoad?: CommonEventFunction
40 /** 图片加载失败时触发
41 * @supported weapp, swan, qq, jd, h5
42 */
43 onError?: CommonEventFunction
44 /** 点击事件回调。
45 * @supported alipay
46 */
47 onTap?: CommonEventFunction
48}
49/** 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。
50 * @classification viewContainer
51 * @supported weapp, alipay, swan, qq, jd, h5, harmony
52 * @example_react
53 * ```tsx
54 * // js
55 * class App extends Components {
56 * render () {
57 * return (
58 * <View className='container'>
59 * <Video id='myVideo' src='src'>
60 * <CoverView className='controls'>
61 * <CoverView className='play' onClick='play'>
62 * <CoverImage className='img' src='src' />
63 * </CoverView>
64 * </CoverView>
65 * </Video>
66 * )
67 * }
68 * }
69 * // css
70 * .container {
71 * position: relative;
72 * }
73 * .controls {
74 * position: absolute;
75 * top: 50%;
76 * left: 50%;
77 * width: 300px;
78 * height: 225px;
79 * transform: translate(-50%, -50%);
80 * }
81 * ```
82 * @example_vue
83 * ```html
84 * <template>
85 * <view class="container">
86 * <video id='myvideo' src='https://ugccsy.qq.com/uwMROfz2r5zBIaQXGdGnC2dfDma3J1MItM3912IN4IRQvkRM/o31507f7lcd.mp4?sdtfrom=v1010&guid=aa18cf106b7fdb7e40f2d20b206f2b4f&vkey=63B0FCCC7FC3ADC342C166D86571AE02772258CD9B515B065DC68DF3919D8C288AE831D570ED5E8FE0FF3E81E170D04FF11F874BFDDACF7AAA2C0CFF2ACB39FB1A94DAD1AB859BDA53E4DD6DBCDC1217CEF789A9AC079924E2BBC599EED7A1FFDD60A727F2EB7E7B6472CE63DD4B683C9199DFC78A6A6C4D9891E05467C4B64E'>
87 * </video>
88 * <cover-view class='controls'>
89 * <cover-view class='play' `@tap='play'>
90 * <cover-image class='img' src='https://img10.360buyimg.com/ling/s345x208_jfs/t1/133501/7/9865/382161/5f5ee31fEbdd6a418/0cdc0156ffff3c23.png' />
91 * </cover-view>
92 * </cover-view>
93 * </view>
94 * </template>
95 *
96 * <style>
97 * .container {
98 * position: relative;
99 * }
100 * .controls {
101 * position: absolute;
102 * top: 50%;
103 * left: 50%;
104 * width: 300px;
105 * height: 225px;
106 * transform: translate(-50%, -50%);
107 * }
108 * </style>
109 * ```
110 * @see https://developers.weixin.qq.com/miniprogram/dev/component/cover-image.html
111 */
112declare const CoverImage: ComponentType<CoverImageProps>
113export { CoverImage, CoverImageProps }