在vue项目中使用Jquery-contextmenu插件的步骤讲解

作者:Moment°回忆 时间:2023-07-02 17:08:29 

使用步骤:

1、安装:

npm i jquery-contextmenu --save-dev

2、在main.js文件中引包


  import Jquery_contextmenu from 'jquery-contextmenu'
  Vue.use(Jquery_contextmenu)
  import 'jquery-contextmenu/dist/jquery.contextMenu.css'

注意:

在引入样式时可以点击进去jquery-contextmenu的安装目录中查找对应的css文件,然后按需引入即可

在vue项目中使用Jquery-contextmenu插件的步骤讲解

3、使用:


<template>
<div>
 <button class="with-cool-menu">Jquery-contextmenu</button>
</div>
</template>
<script>
export default {
 name: "Jquery_contextmenu_44",
 mounted() {
  $.contextMenu({
   selector: '.with-cool-menu',
   callback: function (key, options) {
    var m = "clicked: " + key;
    window.console && console.log(m) || alert(m);
   },
   items: {
    "edit": {name: "Edit", icon: "edit"},
    "cut": {name: "Cut", icon: "cut"},
    copy: {name: "Copy", icon: "copy"},
    "paste": {name: "Paste", icon: "paste"},
    "delete": {name: "Delete", icon: "delete"},
    "sep1": "---------",
    "quit": {
     name: "Quit", icon: function () {
      return 'context-menu-icon context-menu-icon-quit';
     }
    }
   }
  });
  $('.with-cool-menu').on('click', function (e) {
   console.log('clicked', this);
  })
 }
}
</script>
<style scoped>
</style>

效果图:

在vue项目中使用Jquery-contextmenu插件的步骤讲解

来源:https://blog.csdn.net/qq_35366269/article/details/84633087

标签:vue,jquery,contextmenu,插件
0
投稿

猜你喜欢

  • Python采集二手车数据的超详细讲解

    2022-09-23 00:58:22
  • MySQL查询性能优化索引下推

    2024-01-24 15:43:01
  • python删除过期log文件操作实例解析

    2021-02-03 18:29:36
  • cnpm不是内部命令的解决方案:配置环境变量【推荐】

    2023-03-11 13:27:47
  • 使用Django实现商城验证码模块的方法

    2023-11-04 04:46:23
  • 你需要理解的关于MySQL的锁知识

    2024-01-21 05:17:11
  • Python读取本地文件并解析网页元素的方法

    2022-01-10 08:06:27
  • MySQL中SQL模式的特点总结

    2024-01-13 16:08:05
  • mysql 日期和时间格式转换实现语句

    2024-01-22 22:58:38
  • 浅谈Python协程asyncio

    2021-01-12 21:30:32
  • Python函数参数类型及排序原理总结

    2021-12-29 05:12:10
  • mysql 8.0.18 安装配置优化教程

    2024-01-19 22:43:59
  • 简单了解Python write writelines区别

    2023-06-16 14:00:28
  • python中类和实例如何绑定属性与方法示例详解

    2022-01-02 07:22:12
  • Anaconda超详细保姆级安装配置教程

    2022-09-06 08:11:50
  • python获取linux和windows系统指定接口的IP地址的步骤及代码

    2023-04-22 08:22:21
  • Pandas.DataFrame时间序列数据处理的实现

    2022-09-20 08:43:41
  • 解决Python发送Http请求时,中文乱码的问题

    2021-02-02 05:11:39
  • HeidiSQL工具导出导入MySQL数据

    2024-01-19 23:00:32
  • Python中的fileinput模块的简单实用示例

    2023-06-19 01:09:27
  • asp之家 网络编程 m.aspxhome.com