vue悬浮可拖拽悬浮按钮的实例代码悬浮可拖拽悬浮按钮的实例代码
主要介绍了vue悬浮可拖拽悬浮按钮的实例代码,本文通过实例代码给大家介绍的非常详细,具有一定的参考借
鉴价值,需要的朋友可以参考下
前言前言
vue开发手机端悬浮按钮实现,可以拖拽,滚动的时候收到里边,不影响视线
github地址
使用,基于vue-cli3.0+webpack 4+vant ui + sass+ rem适配方案+axios封装,构建手机端模板脚手架 vue-h5-template
后续将发布各种商城组件组件,让商城简单高效开发
线上体验线上体验
使用使用
将 src/components文件夹下的s-icons组件放到你的组件目录下
使用组件使用组件
// template
<template>
<div>
<float-icons padding="10 10 60 10" class="icons-warp">
<div class="float-icon-item">
<img src="../../assets/images/home-icon.png" alt="" @click="handleIcons('home')">
<span>首页</span>
</div>
<div class="float-icon-item">
<img src="../../assets/images/cart-icon.png" alt="" @click="handleIcons('cart')">
<span>购物车</span>
</div>
</float-icons>
</div>
</template>
<script>
import FloatIcons from '@/components/s-icons'
export default {
components: {
'float-icons': FloatIcons
},
methods: {
// 点击按钮
handleIcons(router) {
console.log('router', router)
this.$router.push(router)
}
}
}
</script>
<style lang='scss' scoped>
.icons-warp {
border-radius: 25px;
.float-icon-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
width: 50px;
height: 50px;
img {
width: 25px;
height: 25px;
margin-bottom: 3px;
}
span {
font-size: 9px;
color: #666666;
}