
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、vue 管理系统顶部tags浏览历史实现不用任何vuex,污七八糟的办法,全在一个文件,粘贴即用 放到你想要的位置即可(此demo,放在了面包屑上面) 先安装 (监听某dom元素大小的包) npm install element-resize-detector tags.vue $t("router." + ) 刷新 关闭右侧 关闭其它 import elementresizedetectormaker from "element-resize-detector" export default data() return / 是否有箭头
2、arrowvisible: true, / 点击次数 num: 0, active: 0, tags: , / 右键的元素 contextmenu: index: 0, tag: , menuleft: 0, isshow: false ; , watch: $route() this.getthispage(); , tags() this.listenfun(this.$refs.tags, "tags"); , mounted() this.listenfun(this.$refs.box, "box"); var that = this; doc
3、ument.addeventlistener("click", function(e) that.contextmenu.isshow = false; ); , methods: / 监听可视区域宽,扫瞄器窗口大小转变执行 listenfun(monitor, dom) let boxwidth = this.$refs.box.offsetwidth, tagswidth = this.$refs.tags.offsetwidth, erd = elementresizedetectormaker(); erd.listento(monitor, ele = this.
4、$nexttick() = if ( (dom = "box" && ele.offsetwidth = tagswidth) | (dom = "tags" && ele.offsetwidth = currentp); if (index = -1) this.tags.push( name: currentp, path: currentpgae.path ); / 当前挑选页 this.active = this.tags.findindex(tag = tag.n
5、ame = currentp); , / 关闭标签 handleclose(index, tag) this.tags.splice(this.tags.indexof(tag), 1); if (index = this.tags.length) this.active = index - 1; this.$router.push(this.tagsindex - 1.path); else this.$router.push(this.tagsindex.path); , / 点击标签 clicktag(index, tag) this.active = index; th
6、is.$router.push(tag.path); , / 左侧按钮 handleclicktoleft() if (this.num 0) this.num-; this.$refs.box.style.transform = ——translatex(-$this.num * 200px)—— , / 右侧按钮 handleclicktoright() / 最后一个标签右测距离扫瞄器左侧距离 let lastchild = document .queryselectorall(".top_tags") this.tags
7、.length - 1.getboundingclientrect()。right; / 可视窗口的宽 let bodywidth = document.body.offsetwidth; / 右侧箭头48+右侧边距16 if (bodywidth - lastchild localstorage.setitem( "taginfo", json.stringify( active: this.active, tags: this.tags ) ); ); let taginfo = localstorage.getitem("taginfo") ? j
8、son.parse(localstorage.getitem("taginfo") : active: 0, tags: name: "firstpage1", path: "/first/page1" ; this.active = taginfo.active; this.tags = taginfo.tags; ; /deep/.el-tag-dark border-color: transparent; /deep/.el-tag-dark .el-tag_close color: 86909c; font-size: 16p
9、x; /deep/.el-tag-dark .el-tag_close:hover background: e7eaf0; .tags position: relative; overflow: hidden; .arrow width: 48px; text-align: center; cursor: pointer; background: fff; position: absolute; z-index: 1; &_left left: 0; top: 0; &_right right: 0; top: 0; &_content transition: 0.3s; white-space: nowrap; / padding: 0 16px; .top_tags margin-right: 8px; cursor: pointer; background: fff; font-size: 12px; font-weight: 400; color: 1d2129; .top_tags:hover, .active, .arrow:hover
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 中枢性原始神经外胚层肿瘤的临床护理
- 癌痛控制该不该用杜冷丁课件
- 2024语文《爷爷和小树》教学设计
- 2025年齐齐哈尔如何考货运从业资格证
- 2025年济宁货运资格证考试有哪些项目
- 2025年合作从业资格证应用能力考些啥
- 心理健康《正确认识自己》教学设计
- 《城市轨道交通票务工作》课件-项目一 认知票务管理体系 票务报表的填写
- 大学生问卷调查报告范文
- 阳江职业技术学院《公共健康与预防医学》2023-2024学年第一学期期末试卷
- 济柴190系列柴油机使用维护手册
- 第15课家乡变了样(课件)人教版美术二年级下册
- 仪器仪表产业链分析报告
- 中国南水北调集团新能源投资有限公司招聘笔试题库2024
- (六枝)电厂贮灰场工程施工组织设计
- 铁路货运大数据分析应用
- 工程项目成本管理的案例分析
- 3.2工业区位因素及其变化以大疆无人机为例课件高一地理人教版
- 2024年陕西省中考数学试卷(A卷)附答案
- DL-T5190.1-2022电力建设施工技术规范第1部分:土建结构工程
- 财务预算分析表模板
评论
0/150
提交评论