使用luckysheet报错:luckysheet.umd.js:26 Uncaught TypeError: $(...).mousewheel is not a function


使用luckysheet报错:luckysheet.umd.js:26 Uncaught TypeError: $(…).mousewheel is not a function

在这里插入图片描述

百度方法:

在这里插入图片描述

但自己的VUE项目并没有引入jquery,并且自己下载了jquery 报错还是没有消失!!
而且自己的问题是 excel 单元格 无法点击 后面查了有查,说是jquery引入无效.但所有的demo,官方示例都是如下引入的在这里插入图片描述

最终解决方案

JS 文件在body下面引入

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="pragram" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="expires" content="0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
      <link rel='stylesheet' href='./plugins/css/pluginsCss.css' />
    <link rel='stylesheet' href='./plugins/plugins.css' />
    <link rel='stylesheet' href='./css/luckysheet.css' />
    <link rel='stylesheet' href='./assets/iconfont/iconfont.css' />   
    <title><%= htmlWebpackPlugin.options.title %></title>  
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
      <strong>(当您看到此页面,推荐使用Chrome浏览器获取最佳体验)</strong>
    </noscript>
    <div id="app"></div>
  </body>
  <script type="text/javascript" src="./plugins/js/plugin.js"></script>
  <script type="text/javascript" src="./luckysheet.umd.js"></script>
</html>

补充

为什么js要在body下面引入

1)js放在head里面,会堵塞DOM的生成。使用就无法获取通过选择器获取DOM元素进行操作。
2) 代浏览器除了dom解析完成之后渲染外,为了提高用户体验,会有个first paint。部分内容将被解析并显示,也就是浏览器能够渲染不完整的dom。(如果js放在head里面,就不会出现DOM,所以无法提前渲染,而且提前渲染的前提是发送请求,同步的JS只会卡死GUI渲染,就算发生了paint ,也不会渲染到界面上)

jquery引入注意项

1) jquery 要在js文件引入之前
2)路径引入都要写对,要不然会报$(...).error is not function

  • 5
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值