提交 3171b58f 编写于 作者: X xiaoyucoding

feat: image 组件在 H5 平台支持浏览器中的长按识别

上级 8525739c
<template> <template>
<uni-image v-on="$listeners"> <uni-image v-on="$listeners">
<div :style="modeStyle" /> <div :style="modeStyle" />
<img :src="realImagePath">
</uni-image> </uni-image>
</template> </template>
<script> <script>
...@@ -32,6 +33,9 @@ export default { ...@@ -32,6 +33,9 @@ export default {
ratio () { ratio () {
return this.originalWidth && this.originalHeight ? this.originalWidth / this.originalHeight : 0 return this.originalWidth && this.originalHeight ? this.originalWidth / this.originalHeight : 0
}, },
realImagePath () {
return this.$getRealPath(this.src)
},
modeStyle () { modeStyle () {
let size = 'auto' let size = 'auto'
let position = '' let position = ''
...@@ -149,6 +153,7 @@ export default { ...@@ -149,6 +153,7 @@ export default {
height: 240px; height: 240px;
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
position: relative;
} }
uni-image[hidden] { uni-image[hidden] {
...@@ -165,6 +170,12 @@ export default { ...@@ -165,6 +170,12 @@ export default {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
display: block; display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
} }
uni-image>.uni-image-will-change { uni-image>.uni-image-will-change {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册