25 changed files with 150 additions and 271 deletions
@ -0,0 +1,47 @@ |
|||
Component({ |
|||
data: { |
|||
}, |
|||
properties: { |
|||
areaTop: { |
|||
type: Number, |
|||
value: 0 |
|||
}, |
|||
areaLeft: { |
|||
type: Number, |
|||
value: 0 |
|||
}, |
|||
areaWidth: { |
|||
type: String, |
|||
value: '100%' |
|||
}, |
|||
areaHeight: { |
|||
type: String, |
|||
value: '100%' |
|||
}, |
|||
buttonWidth: { |
|||
type: Number, |
|||
value: 178 |
|||
}, |
|||
buttonHeight: { |
|||
type: Number, |
|||
value: 178 |
|||
}, |
|||
buttonTop: { |
|||
type: Number, |
|||
value: 1000 |
|||
}, |
|||
buttonLeft: { |
|||
type: Number, |
|||
value: 560 |
|||
}, |
|||
imgUrl: { |
|||
type: String, |
|||
value: '' |
|||
} |
|||
}, |
|||
methods: { |
|||
onClickButton () { |
|||
this.triggerEvent('movebtnCallBack') |
|||
} |
|||
} |
|||
}) |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"component": true |
|||
} |
@ -0,0 +1,8 @@ |
|||
<movable-area class="movable-area" style="top:{{areaTop}}rpx;left:{{areaLeft}}rpx;width:{{areaWidth}};height:{{areaHeight}};"> |
|||
<movable-view class="movable-view" direction="all" inertia="true" friction="10" |
|||
style="width:{{buttonWidth}}rpx;height:{{buttonHeight}}rpx;top:{{buttonTop}}rpx;left:{{buttonLeft}}rpx;"> |
|||
<view class="img-box" bindtap="onClickButton"> |
|||
<image src="{{imgUrl}}" /> |
|||
</view> |
|||
</movable-view> |
|||
</movable-area> |
@ -0,0 +1,34 @@ |
|||
|
|||
/* 悬浮按钮 -start- */ |
|||
.movable-area{ |
|||
pointer-events:none; |
|||
z-index: 999; |
|||
width: 100%; |
|||
height: 90%; |
|||
position: fixed; |
|||
top: 60px; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
} |
|||
.movable-view{ |
|||
pointer-events:auto; |
|||
width: 178rpx; |
|||
height: 178rpx; |
|||
transform: translateX(560rpx) translateY(680rpx) translateZ(0rpx) scale(1); |
|||
transform-origin: center center; |
|||
will-change: auto; |
|||
position: absolute; |
|||
top: 1100rpx; |
|||
left: 560rpx; |
|||
} |
|||
.img-box { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
.img-box image { |
|||
width: 100%; |
|||
height: 100%; |
|||
object-fit: cover; |
|||
} |
|||
/* 悬浮按钮 -end- */ |
Loading…
Reference in new issue