Vue实现靠边悬浮球(PC端)
我想把退出登录的按钮做成一个悬浮球的样子,带动画的那种。
实现是这个样子:
手边没有球形图。所以用的毕设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端)的更多相关文章
- vue搭配的UI框架 pc端 + 移动端
PC桌面端UI框架: 1,iview (最新,用户评分高功能多炫酷 解决和避免了其他UI框架出现的一些小问题) 2, bootstrap (使用用户最多样式死板没特色) 3,Element ...
- 【vue】vue +element 搭建项目,要求既支持pc端又支持移动端
使用场景:有适配pc端改为适配pc端和移动端,使用2套css 代码实现App.vue created: function () { if(document.documentElement.client ...
- vue pc端网站项目开发坑点与难度记录
背景 在一pc端的web项目里,由于某些特性需要由动态语言处理,所以只在有需要使用vue来处理数据的页面,直接引入vue.js来处理.由于刚开始并没有打算使用前端来渲染数据和处理交互,所以使用了一些非 ...
- vue 项目 切换手机端和pc端。同一个项目,配置不同的路由
1, 首先判断设备:在main.js里面写 // vue原型挂载 - 是否PC端 if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator. ...
- Vue PC端框架
Vue PC端框架 1. Element 中文文档:http://element-cn.eleme.io/#/zh-CN github地址:https://github.com/ElemeFE/ele ...
- 使用vue实现简单键盘,支持移动端和pc端
常看到各种app应用中使用自定义的键盘,本例子中使用vue2实现个简单的键盘,支持在移动端和PC端使用,欢迎点赞,h5 ios输入框与键盘 兼容性优化 实现效果: Keyboard.vue <t ...
- vue实现PC端分辨率适配
lib-flexible + px2rem Loader lib-flexible 阿里伸缩布局方案 px2rem-loader:px转rem: 依赖 首先需要安装 vue-cli 脚手架,这里我安装 ...
- 【实战问题】【4】Vue写的页面在微信手机端和微信web开发者工具中都能正常显示,但是在微信pc端上显示空白
原因:pc端微信浏览器不支持es6,而代码中使用了 let . 解决:将 let 改为 var(若使用 es6 语法比较多,可以进行转换,将 es6 语法转为 es5) 参考博客: 1,h5微信页面在 ...
- vue实现PC端调用摄像头拍照人脸录入、移动端调用手机前置摄像头人脸录入、及图片旋转矫正、压缩上传base64格式/文件格式
进入正题 1. PC端调用摄像头拍照上传base64格式到后台,这个没什么花里胡哨的骚操作,直接看代码 (canvas + video) <template> <div> &l ...
随机推荐
- 讲讲HashMap的理解,以及HashMap在1.7和1.8版本的变化(2020/4/16)
HashMap的适用场景,作用,优缺点
- 第十节:xml、re、logging模块
XML模块:(用到的时候再看)tree=xml.parse('xmltest.xml')root= tree.getroot()print(root.tag) 打印对象的标签root.attrib 获 ...
- win7下delphi中的help文档问题
一,要安装WinHlp32.exe 文件 二, 三,在安装目录下:
- 在众多小说中,Python告诉你哪本小说好看
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 有趣的Python PS:如有需要Python学习资料的小伙伴可以 ...
- jQuer实时监控input对table进行筛选
记得以前写过一个预定表格~~~~~比这个更难,一大串前端js~~~忘了~~~好记性不如烂笔头~~记录下,既帮助别人,也帮助自己~~~ 实现思路~通过.on监听input标签的内容变化,通过this获取 ...
- Java日期时间API系列30-----Jdk8中java.time包中的新的日期时间API类,减少时间精度方法性能比较和使用。
实际使用中,经常需要使用不同精确度的Date,比如保留到天 2020-04-23 00:00:00,保留到小时,保留到分钟,保留到秒等,常见的方法是通过格式化到指定精确度(比如:yyyy-MM-dd) ...
- pytorch seq2seq闲聊机器人
cut_sentence.py """ 实现句子的分词 注意点: 1. 实现单个字分词 2. 实现按照词语分词 2.1 加载词典 3. 使用停用词 "" ...
- 轻量级mysql安装教程-避免采坑
1:安装包获取 安装了很多次,来来回回踩,踩出了一片光明大道,简单好用. 百度网盘获取:链接:https://pan.baidu.com/s/13frFBTODaMeADZOHj5KdJQ 提取码:a ...
- XSS语义分析的阶段性总结(二)
本文首发于“合天智汇”微信公众号,作者:Kale 前言 上次分享了javascript语义分析,并且简单介绍了新型xss扫描器的一些想法,如何在不进行大量fuzz的情况下又能准确的检测出xss漏洞,这 ...
- Mac home 目录下创建文件夹
example:sudo vim /etc/auto_master before: # Automounter master map +auto_master # Use directory serv ...