我想把退出登录的按钮做成一个悬浮球的样子,带动画的那种。

实现是这个样子:

手边没有球形图。所以用的毕设PPT扣的  校~,今年毕业,功能这里演示的为单机悬浮球注销登录

嗯,具体代码:

  <div
:class="['meun-switch animated flex-row',uploadflag ? 'active rubberBand off' : 'leave jello']"
@mouseleave="uploadleave"
@mouseenter="uploadenter"
v-if="uploadShow"
@click.stop="logout"
>
<img :src="require('@/assets/1.png')"/>
</div>

data

                uploadShow: false,
uploadflag: true,

js方法

  uploadenter() {
this.uploadflag = true;
},
uploadleave() {
this.uploadflag = false; },
uploadanimated() {
setTimeout(() => {
this.uploadShow = true;
setTimeout(() => {
this.uploadleave();
}, 1000);
}, 1000);
},

css

  .off{
-webkit-animation:1s seconddiv;
background: transparent;
} @keyframes seconddiv{
0% {transform: scale(1.4,1.4);}
10% {transform: scale(1,1);}
25% {transform: scale(1.2,1.2);}
50% {transform: scale(1,1);}
70% {transform: scale(1.2,1.2);}
100% {transform: scale(1,1);}
}
.meun-switch {
position: fixed;
top: 90px;
left: 0px;
z-index:;
cursor: pointer;
width: 150px;
height: 150px;
padding: 5px;
transition: all 0.25s; &.leave {
left: -65px;
} &.active {
left:;
} &:hover {
transform: scale(1.02);
} img {
width: 120px;
height: 120px;
}
}

页面代码:

<template>
<div id="app">
<transition name="el-zoom-in-center">
<div v-show="show3">
<div class="sidebar">
<!-- <card></card>-->
<list></list>
<div
:class="['meun-switch animated flex-row ys-float-btn',uploadflag ? 'active rubberBand off' : 'leave jello']"
@mouseleave="uploadleave"
@mouseenter="uploadenter"
v-if="uploadShow"
@click.stop="logout"
>
<img :src="require('@/assets/logo.png')"/>
</div>
</div>
<div class="main">
<message></message>
<usertext></usertext>
</div>
</div>
</transition> </div>
</template> <script> import list from '../../components/chat/list.vue'
import message from '../../components/chat/message.vue'
import usertext from '../../components/chat/usertext.vue'
import screenfull from 'screenfull' export default {
name: 'pageChat',
data() {
return {
//默认不全屏
isFullscreen: false,
show3: false,
uploadShow: false,
uploadflag: true,
}
},
created() { },
mounted: function () {
this.uploadanimated();
this.$store.dispatch('connect');
this.inintview();
},
methods: {
/*注销*/
logout () {
this.$confirm('此操作注销登录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.getRequest('/logout');
window.sessionStorage.removeItem("user");
// 清除缓存
this.$router.replace("/");
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
inintview() {
setTimeout(() => {
this.show3 = true;
}, 1000)
},
uploadenter() {
this.uploadflag = true;
},
uploadleave() {
this.uploadflag = false; },
uploadanimated() {
setTimeout(() => {
this.uploadShow = true;
setTimeout(() => {
this.uploadleave();
}, 1000);
}, 1000);
},
click() {
// 如果不允许进入全屏,发出不允许提示 浏览器不能全屏
if (!screenfull.enabled) {
this.$message({
message: '浏览器不能全屏',
type: 'warning'
})
return false
}
screenfull.toggle()
this.$message({
message: '全屏啦',
type: 'success'
})
} },
components: {
list,
message,
usertext
}
}
</script> <style lang="scss" scoped>
.off{
-webkit-animation:1s seconddiv;
background: transparent;
} @keyframes seconddiv{
0% {transform: scale(1.4,1.4);}
10% {transform: scale(1,1);}
25% {transform: scale(1.2,1.2);}
50% {transform: scale(1,1);}
70% {transform: scale(1.2,1.2);}
100% {transform: scale(1,1);}
}
.meun-switch {
position: fixed;
top: 90px;
left: 0px;
z-index: 2001;
cursor: pointer;
width: 150px;
height: 150px;
padding: 5px;
transition: all 0.25s; &.leave {
left: -65px;
} &.active {
left: 0;
} &:hover {
transform: scale(1.02);
} img {
width: 120px;
height: 120px;
}
} #particles-js {
width: 100%;
height: calc(100% - 100px);
position: absolute;
overflow: hidden;
} #app {
/*背景裁剪在背景边框内部*/
background-clip: padding-box;
/*// 边框样式*/
border: 1px solid #eaeaea;
/*// 边框阴影*/
box-shadow: 0 0 25px #cac6c6;
margin: 20px auto;
width: 1100px;
height: 100%;
overflow: hidden;
border-radius: 10px;
overflow-x: hidden; .sidebar,
.main {
height: 100%;
} .sidebar {
float: left;
color: #f4f4f4;
background-color: transparent;
width: 300px;
height: 100%
} .main {
position: relative;
overflow: hidden;
background-color: transparent;
}
}
</style>

Vue实现靠边悬浮球(PC端)的更多相关文章

  1. vue搭配的UI框架 pc端 + 移动端

    PC桌面端UI框架: 1,iview      (最新,用户评分高功能多炫酷 解决和避免了其他UI框架出现的一些小问题) 2, bootstrap  (使用用户最多样式死板没特色) 3,Element ...

  2. 【vue】vue +element 搭建项目,要求既支持pc端又支持移动端

    使用场景:有适配pc端改为适配pc端和移动端,使用2套css 代码实现App.vue created: function () { if(document.documentElement.client ...

  3. vue pc端网站项目开发坑点与难度记录

    背景 在一pc端的web项目里,由于某些特性需要由动态语言处理,所以只在有需要使用vue来处理数据的页面,直接引入vue.js来处理.由于刚开始并没有打算使用前端来渲染数据和处理交互,所以使用了一些非 ...

  4. vue 项目 切换手机端和pc端。同一个项目,配置不同的路由

    1, 首先判断设备:在main.js里面写 // vue原型挂载 - 是否PC端 if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator. ...

  5. Vue PC端框架

    Vue PC端框架 1. Element 中文文档:http://element-cn.eleme.io/#/zh-CN github地址:https://github.com/ElemeFE/ele ...

  6. 使用vue实现简单键盘,支持移动端和pc端

    常看到各种app应用中使用自定义的键盘,本例子中使用vue2实现个简单的键盘,支持在移动端和PC端使用,欢迎点赞,h5 ios输入框与键盘 兼容性优化 实现效果: Keyboard.vue <t ...

  7. vue实现PC端分辨率适配

    lib-flexible + px2rem Loader lib-flexible 阿里伸缩布局方案 px2rem-loader:px转rem: 依赖 首先需要安装 vue-cli 脚手架,这里我安装 ...

  8. 【实战问题】【4】Vue写的页面在微信手机端和微信web开发者工具中都能正常显示,但是在微信pc端上显示空白

    原因:pc端微信浏览器不支持es6,而代码中使用了 let . 解决:将 let 改为 var(若使用 es6 语法比较多,可以进行转换,将 es6 语法转为 es5) 参考博客: 1,h5微信页面在 ...

  9. vue实现PC端调用摄像头拍照人脸录入、移动端调用手机前置摄像头人脸录入、及图片旋转矫正、压缩上传base64格式/文件格式

    进入正题 1. PC端调用摄像头拍照上传base64格式到后台,这个没什么花里胡哨的骚操作,直接看代码 (canvas + video) <template> <div> &l ...

随机推荐

  1. matlab创建HDF5文件

    一.例子 1.创建写入 testdata = uint8(magic(5)); h5create('my_example.h5','/dataset1',size(testdata)); %创建 h5 ...

  2. JS Math&Date的方法 (下)

    Date - 时间日期对象 一:Date 时间对象 - 它是处理时间日期的 时间日期对象  - js提供了一个专门用来创建日期对象的构造函数 Date          new Date()  这是一 ...

  3. file_put_contens小trick

    file_put_contents tricks 0x01 trick1 来自于P神的实例: <?php $text = $_GET['text']; if(preg_match('[<& ...

  4. WPF中在Gmap.net中将Marker动起来

    前一段时间说过一篇绘制极坐标的,这段时间对它进行了改造已经今非昔比了,功能实现了很多,我目的是让Marker动起来,然后还会绘制Route,上篇也就是简单的绘制了Route,没有关于Marker的相关 ...

  5. Springboot:异步业务处理(十二)

    说明 当正常业务处理调用一个复杂业务或者耗时较长的请求时,客户等待时间会比较长,造成不好的用户体验,所以这时候需要用的异步处理 构建一个群发邮件的service接口及实现(模拟) 接口:com\spr ...

  6. MySQL基础知识和常用命令总结

    说明:以下内容是阅读书籍<<MySQL必知必会>>的摘要和总结 检索数据 排序检索数据 过滤数据 使用通配符过滤 使用正则表达式进行搜索 创建计算字段 使用数据处理函数 汇总数 ...

  7. xpath进阶用法

    一.简介 xpath作为对网页.对xml文件进行定位的工具,速度快,语法简洁明了,在网络爬虫解析内容的过程中起到很大的作用,除了xpath的基础用法之外xpath中还存在着非常之多的进阶用法,本文将对 ...

  8. Java创建对象时的简单内存分析

    简单创建对象的内存分析 主程序: 1 public class Application { 2 public static void main(String[] args) { 3 Animal do ...

  9. 如何在 Windows Event Log 中查找系统重启的信息

    事件ID:12 事件ID 13: 事件ID 41: 事件ID 6008: 事件ID 1074:事件ID 1074: ========================================== ...

  10. Zabbix数据库表分区

    zabbix的监控主机数量将近300,且运行了一年时间了,最近zabbix server服务监控历史数据等服务不断自身告警.查询性能也变得很低 关于历史数据的两个参数,在zabbix server的配 ...