vue右键自定义样式

在这里插入图片描述

<!-- eslint-disable vue/no-dupe-keys -->
<template>
  <div>
    <div class="search-box">
      <div class="search">
        <el-input placeholder="搜索" prefix-icon="el-icon-search" v-model="input2">
        </el-input>
      </div>
    </div>
    <div @contextmenu.prevent="showMenu" class="card-box">
      <el-card class="card" v-for="(item, index) in DataMergin" :key="index">
        <img :src="item.image" class="image" />
        <div class="card-txt">
          <span>{{ item.title }}</span>
          <div class="bottom clearfix">
            <span>更新时间:{{ item.time }}</span>
          </div>
        </div>
      </el-card>
    </div>
    <div class="fixed-box" :style="{ 'left': menuLeft + 'px', 'top': menuTop + 'px' }" ref="fixedBoxRef" @blur="handle"
      v-show="isShowMenu">
      <div :class="index == currentItmeIndex ? 'current-color' : ''" @mouseenter="handleMouseEnter(item, index)"
        class="menu-item" v-for="(item, index) in menusItme">
        <i class="icon-position" :class="index == currentItmeIndex ? 'el-icon-check' : ''"></i>
        {{ item }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      input2: "",
      isShowMenu: false,
      menuLeft: '',
      menuTop: '',
      iconShow: false,
      fixedBoxRef: '',
      menusItme: ['模型详情', '重命名', '分享', '移动到', '更新', '简略图', '模型对比', '删除', '插入', '切换'],
      currentItmeIndex: '',
      DataMergin: [
        {
          title: "Revit",
          image: require("../../assets/DataMerging_img/Revit.png"),
          time: "2021.01.31",
        },
        {
          title: "Navisworks",
          image: require("../../assets/DataMerging_img/Navisworks.png"),
          time: "2021.01.31",
        },
        {
          title: "MicroStation",
          image: require("../../assets/DataMerging_img/MicroStation.png"),
          time: "2021.01.31",
        },
        {
          title: "PDMS",
          image: require("../../assets/DataMerging_img/PDMS.png"),
          time: "2021.01.31",
        },
        {
          title: "Sketchup",
          image: require("../../assets/DataMerging_img/Sketchup.png"),
          time: "2021.01.31",
        },
        {
          title: "Inventor",
          image: require("../../assets/DataMerging_img/Inventor.png"),
          time: "2021.01.31",
        },
        {
          title: "3Ds MAX",
          image: require("../../assets/DataMerging_img/3Ds MAX.png"),
          time: "2021.01.31",
        },
        {
          title: "AUTOCAD",
          image: require("../../assets/DataMerging_img/AUTOCAD.png"),
          time: "2021.01.31",
        },
      ],
    };
  },
  mounted() {
    //失去焦点时关闭右击菜单
    document.addEventListener("click", (e) => {
      if (!this.$refs.fixedBoxRef.contains(e.target)) { this.isShowMenu = false; }
    });
  },

  methods: {
    handleMouseEnter(item, index) {
      // console.log('鼠标移入', item, index);

      this.currentItmeIndex = index;
      if (this.currentItmeIndex === index) {
        // console.log("相同");
        this.iconShow = true
      };
    },
    showMenu(e) {
      // console.log('ssssssssssssssss', e);
      e.preventDefault()
      this.isShowMenu = true
      this.menuLeft = e.pageX
      this.menuTop = e.pageY
    },
    handle() {
      // console.log("失去焦点");
    }


  }
};
</script>
<style lang="scss" scope>
.search-box {
  padding: 15px 55px 50px 0px;
  background-color: #fff;
  box-shadow: 0 3px 10px rgba(202, 196, 196, 0.3);
}

.search {
  width: 15%;
  float: right;
}

.card-box {
  margin: 20px;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
  color: #c1c1c1;
  font-size: 14px;
}

.image {
  width: 100%;
  height: 250px;
  display: block;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}

.card {
  text-align: center;
  width: 23.5%;
  height: 350px;
  margin: 0.7%;
}

.card-txt {
  padding: 14px;
  text-align: center;
  font-size: 20px;
}

.fixed-box {
  background-color: red;
  // position: absolute;
  position: fixed;
  z-index: 1004;
  background-color: #dadada;
  border-radius: 5px;
  width: 100px;
  padding-bottom: 8px;
  // height: 200px;
}

.menu-item {
  // position: absolute;
  // display: flex;
  // justify-content: center;
  // align-items: center;
  padding-left: 30%;
  cursor: pointer;
  margin-top: 8px;
  position: relative;
}

.current-color {
  background-color: grey;
}


.icon-position {
  position: absolute;
  left: 5px;
  top: 2px
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/455912.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

STM32OLED调试工具

OLED介绍 4个引脚的oled &#xff1a; GND引脚接地&#xff0c;VCC接3.3v的电源 SCL与SDA是I2C通信的引脚 使用OLED显示屏驱动函数模块 接线图 将oled函数调试的代码引入到工程项目中 oled工程代码 OLED.C文件代码 #include "stm32f10x.h" #include "OLED_Font…

自定义方法SQL注入器-DefaultSqlInjector

/*** 自定义Sql注入* author zy*/ public class SqlInjector extends DefaultSqlInjector {Overridepublic List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {// 注意&#xff1a;此SQL注入器继承了DefaultSqlInjector(默认注入器…

Oracle 主从切换脚本

一、 切换前预检查 1. dg_precheck_main_v1.4.sh #!/bin/bash#********************************************************************************** # Author: Hehuyi_In # Date: 2022年06月16日 # FileName: dg_precheck_main_v1.4.sh # # For sys user, execute the sc…

2024年初中生古诗文大会备考:多选题真题和独家解析(持续更新)

今天我们继续来做初中古诗文大会的一道难题&#xff1a;多选题&#xff0c;让大家了解初中生古诗文大会的考察内容和形式&#xff0c;并且提供了我独家的题目解析和答案&#xff0c;供初中的同学们学习和参考。 Tips&#xff1a;古诗文大会的许多题目都来自于中考、高考&#…

goland设置保存文件时不将4个空格转为TAB

goland设置保存文件时不将4个空格转为TAB 版本&#xff1a;GoLand 2022.3 设置路径&#xff1a; Settings -> Editor -> Code Style -> Go -> Run gofmt图示&#xff1a;

springmvc学习笔记1

springmvc学习笔记part1 总概述图创建步骤创建project并在父工程中导入配置类添加为web工程检查maven配置写handller方法写配置类SpringMVC环境搭建项目部署关键步骤总结 具体设置路径设置注解接收参数&#xff08;重点param参数接收路径参数接收json参数接收请求头接收和cooki…

【Unity】persistentDataPath、streamingAssetsPath和dataPath

介绍 我们在用Unity进行开发时&#xff0c;资源路径是我们最常用到的&#xff0c;下面我就来简单介绍一下几种常用的路径。 1.dataPath dataPath是包含游戏数据文件夹的路径&#xff0c;是app程序包安装路径 Windows: xxx /Assets &#xff08;如下图&#xff09; Mac: xxx…

canvas绘制圆形进度条

canvas绘制圆形进度条 用canvas绘制了一个圆形进度条&#xff0c;记录一下&#xff1a; 效果如下&#xff1a; 感觉效果还行&#xff0c;不过有待优化 代码如下&#xff1a; 我是用Vue写的 组件的代码&#xff1a; progressCanvas.vue <template><div><can…

深度学习——基本数据类型创建Tensor(持续更新)

声明&#xff1a;本深度学习笔记基于课时18 索引与切片-1_哔哩哔哩_bilibili学习而来 All is about Tensor 定义&#xff1a;Tensors are simply mathematical objects that can be used to describe physical properties, just like scalars and vectors. In fact tensors a…

C语言黑魔法第三弹——动态内存管理

本文由于排版问题&#xff0c;可能稍显枯燥&#xff0c;但里面知识点非常详细&#xff0c;建议耐心阅读&#xff0c;帮助你更好的理解动态内存管理这一C语言大杀器 进阶C语言中有三个知识点尤为重要&#xff1a;指针、结构体、动态内存管理&#xff0c;这三个知识点决定了我们…

QT定时器使用

实现功能&#xff1a;在界面中显示日期跟时间&#xff0c;并时刻刷新 实现原理&#xff1a;定时器能反馈程序运行的时间&#xff0c;通过设定定时器的启动间隔可以实现对时间的更新 步骤&#xff1a; 1.设定两个QString分别获取系统当前的日期和时间&#xff0c;并导入到labl…

线性代数 --- 特征值与特征向量(下)

特征值与特征向量 Eigen Values & Eigen Vectors Part III:如何求解特征向量与特征值 The Key Equation 对于一般矩阵A&#xff0c;如何找到他的特征值与特征向量&#xff1f; Step I: Find λ first! 首先&#xff0c;我们有方程&#xff1a; 但这里有两个未知数&…

Git win与linux换行符转换的问题

转载&#xff1a;warning: in the working copy of ‘package-lock.json‘, LF will be replaced by CRLF the next time Git_warning: in the working copy of package.json, lf-CSDN博客 warning: in the working copy of ‘package-lock.json‘, LF will be replaced by CRL…

“人工智能+”成国策,天翼云如何打造大模型时代的驱动力样板?

文 | 智能相对论 作者 | 叶远风 两会政府工作报告中明确指出要制定支持数字经济高质量发展政策&#xff0c;开展“人工智能”行动&#xff0c;这意味着&#xff0c;“人工智能”已经成为国策。 在这种大背景下&#xff0c;大模型的重要性无疑被抬到了新的高度。 此时&#…

数据结构和算法:栈与队列

栈 栈 &#xff08;stack&#xff09;是一种遵循先入后出逻辑的线性数据结构 把堆叠元素的顶部称为“栈顶”&#xff0c;底部称为“栈底”。 将把元素添加到栈顶的操作叫作“入栈”&#xff0c;删除栈顶元素的操作叫作“出栈”。 栈的常用操作 /* 初始化栈 */ stack<int&g…

小明的背包——01背包问题

经典版 题目链接&#xff1a;1.小明的背包1 - 蓝桥云课 (lanqiao.cn) 01背包问题中&#xff0c;每种物品只有两种状态&#xff0c;即拿或不拿。设状态dp[i][j]max(dp[i-1][j],dp[i-1][j-w]v)&#xff1b;如果不拿物品i&#xff0c;那么最大价值就是dp[i-1][j]&#xff0c;如果…

Excel第26享:模糊查找之Hlookup函数与通配符的嵌套

1、需求描述 如下图所示&#xff0c;现第一行有三个参考值&#xff1a;人S、羊E、猪3&#xff0c;在第三行有5个字&#xff1a;马、牛、人、羊、猪&#xff0c;每个字如果出现在第一行的三个参考值中&#xff0c;就返回该单元格的数值。如&#xff0c;人&#xff0c;就返回“人…

Windows 应用商城无法打开,解决方法

Windows 应用商城无法打开&#xff0c;也会导致有些软件无法使用&#xff0c;比如动态主题无法更新。 解决方&#xff1a; 1、按windowsR键&#xff0c;输入inetcpl.cpl。确定。 2、Internet属性&#xff0c;高级&#xff0c;勾选“使用TLS1.1",“使用TLS1.2"。确定…

docker镜像ssh服务

基于commit命令实现 首先我们是基于Ubuntu:18.04版本做ssh服务&#xff0c;拉取镜像 [rootmaster ~]# docker pull ubuntu:18.04 [rootmaster ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 18.04 f9a80a5…

RabbitMQ 模拟实现【三】:存储设计

文章目录 数据库设计SQLite配置数据库实现 数据库关于哈希表等复杂类的存储启动数据库 文件设计消息持久化消息属性格式核心方法消息序列化消息文件回收 统一硬盘存储管理内存存储管理线程安全数据结构实现 数据库设计 数据库主要存储交换机、队列、绑定 SQLite 此处考虑的是…