此章主要介绍如何使用uniapp跨平台开发,实现悬浮按钮,移动端经常会有所这样的需求,那么功能如下:
1.圆圈悬浮球,上下左右靠边显示
2.可以界面任何拖动,不会超出界面
3.单击悬浮球的点击事件
效果:
代码如下:(复制粘贴就可运行看效果,小白也不用担心)
<template>
<view class="content">
<movable-area class="movableArea">
<movable-view class="movableView"
:position="position"
:x="x"
:y="y"
:direction="direction"
:damping="damping"
@change="onChange"
@tap="onTap"
@touchend="onTouchend">
<image src="../../static/homeShow.png" mode="widthFix" class="iconImage"></image>
</movable-view>
</movable-area>
</view>
</template>
<script