File tree Expand file tree Collapse file tree 4 files changed +18
-2
lines changed
uni_modules/wot-design-uni/components/wd-img Expand file tree Collapse file tree 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ mode 为小程序原生属性,参考[微信小程序 image 官方文档](https
8787<wd-img :width =" 100" :height =" 100" :src =" joy" :enable-preview =" true" />
8888```
8989
90+ 也可以传入 ` preview-src ` 属性来预览另外的图片
91+
92+ ``` html
93+ <wd-img :width =" 100" :height =" 100" :src =" joy" :preview-src =" img" :enable-preview =" true" />
94+ ```
95+
9096## Attributes
9197
9298| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
@@ -99,6 +105,7 @@ mode 为小程序原生属性,参考[微信小程序 image 官方文档](https
99105| radius | 圆角大小,默认单位为 px | number / string | - | - | - |
100106| enable-preview | 是否支持点击预览 | boolean | - | false | 1.2.11 |
101107| show-menu-by-longpress | 开启长按图片显示识别小程序码菜单,仅微信小程序支持 | boolean | - | false | 1.3.11 |
108+ | preview-src | 预览图片链接 | string | - | - | $LOWEST_VERSION$ |
102109
103110## Events
104111
Original file line number Diff line number Diff line change 4848 </demo-block >
4949
5050 <demo-block title =" 可预览" >
51- <wd-img :width =" 100" :height =" 100" :src =" joy" :enable-preview =" true" />
51+ <view class =" col" >
52+ <wd-img :width =" 100" :height =" 100" :src =" joy" :enable-preview =" true" />
53+ </view >
54+ <view class =" col" >
55+ <wd-img :width =" 100" :height =" 100" :src =" joy" :preview-src =" img" :enable-preview =" true" />
56+ </view >
5257 </demo-block >
5358 </page-wraper >
5459</template >
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ export const imgProps = {
2222 * 图片链接
2323 */
2424 src : String ,
25+ /**
26+ * 预览图片链接
27+ */
28+ previewSrc : String ,
2529 /**
2630 * 是否显示为圆形
2731 */
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ function handleError(event: any) {
7373function handleClick(event : MouseEvent ) {
7474 if (props .enablePreview && props .src && status .value == ' success' ) {
7575 uni .previewImage ({
76- urls: [props .src ]
76+ urls: [props .previewSrc || props . src ]
7777 })
7878 }
7979 emit (' click' , event )
You can’t perform that action at this time.
0 commit comments