【ZeroClipboard is not defined】的解决方法
参考:http://www.cnblogs.com/jfw10973/p/3921899.html
https://github.com/zeroclipboard/zeroclipboard
近期该项目引入了Requirejs,结果发现在有富文本编辑器的页面都会在控制台报出如下异常:
if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
module.exports = ZeroClipboard;
} else {
window.ZeroClipboard = ZeroClipboard;
}
意思就是说
如果当前页面的模块加载模式是AMD的 则定义模块
如果是CommonJs的,则输出到模块 ZeroClipboard
否则 把 ZeroClipboard 定义为全局变量
这样 解决方案就有两种。
①不使用模块加载模式来使用这个功能
这样方法需要修改一点源码,把上面这段代码替换成如下代码即可
if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
module.exports = ZeroClipboard;
}
window.ZeroClipboard = ZeroClipboard;
②如果不修改源码,就得在模块加载时做处理了
首先是修改配置
require.config({
baseUrl: '',
paths: {
ZeroClipboard: "./UEditor.../ZeroClipboard"//主要是加这句话
}
});
然后是在调用这个模块并把模块定义到全局变量
require(['ZeroClipboard'], function (ZeroClipboard) {
window['ZeroClipboard'] = ZeroClipboard;
});
【ZeroClipboard is not defined】的解决方法的更多相关文章
- 报错NameError: name ‘null’ is not defined的解决方法
报错NameError: name 'null' is not defined的解决方法 eval()介绍 eval()函数十分强大,官方demo解释为:将字符串str当成有效的表达式来求值并返回计算 ...
- [Vue warn]: Failed to mount component: template or render function not defined. 错误解决方法
解决方法import Vue from "vue"; 默认引入的文件是 vue/dist/vue.runtime.common.js.这个可以在node_modules/vue/p ...
- KEIL软件中编译时出现的Error L6200E: symbol multiply defined ...的解决方法
原因:如LCD.C文件使用了bmp.h中的image[ ]变量,那么就不能将#include"bmp.h"放在LCD.H中,要将#include"bmp.h"放 ...
- variable '' of type '' referenced from scope '', but it is not defined 异常解决方法
最近在做一个功能,通过拼接lamdba表达试来实现的功能,但测试时总是出现一个错误,如下图所示,网上也找不到答案,差点都放弃了.. 如上图图所示,我是想通过一个lamdba表达式(上图的IdField ...
- Target runtime Apache Tomcat v6.0 is not defined.错误解决方法
一.背景 最近在使用本地的tomcat进行运行项目的时候,发现出现了如题所述的问题.不知道什么原因,经过努力解决了该问题. 二.解决步骤 右击项目---选择属性---选择targeted runtim ...
- 【java】关于Cannot refer to the non-final local variable list defined in an enclosing scope解决方法
今天学习中遇到了一个问题: Cannot refer to the non-final local variable list defined in an enclosing scope 这里的new ...
- 错误/异常:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/beans_common.xml]...的解决方法
1.第一个这种类型的异常 1.1.异常信息:org.springframework.beans.factory.BeanCreationException: Error creating bean w ...
- python __file__ is not defined 解决方法
python __file__ is not defined 解决方法 __file__ 是在python module 被导入的时候生成的一个变量,所以在 __file__ 不能被使用,但是又想获取 ...
- tomcat配置报错解决方法 The jre_home environment variable is not defined correctly
tomcat配置的时候弹出错误,The jre_home environment variable is not defined correctly,难道jre环境变量配置不正确?但是我们又可以执行j ...
随机推荐
- 最完整的Elasticsearch 基础教程
翻译:潘飞(tinylambda@gmail.com) 基础概念 Elasticsearch有几个核心概念.从一开始理解这些概念会对整个学习过程有莫大的帮助. 接近实时(NRT) Ela ...
- iPad开发--iPad中modal的更多用法
可以设置modal的呈现样式,常见的有以下四种 设置modal的过度样式,也就是展现时候的动画效果 代码示例
- 用cmd重命名.htaccess
本人上天修改PHP下伪静态文件htaccess.txt,需要改为.htaccess要是在Linux倒是很随意的事情,可惜window不给改,真的不可改吗,其实方法还是很多的,比如复制在记事本另存也可以 ...
- 引入AOP 报错 error at ::0 formal unbound in pointcut
使用了AOP 后启动报错 九月 27, 2016 2:29:46 下午 org.springframework.context.support.AbstractApplicationContext r ...
- 【BZOJ-3275&3158】Number&千钧一发 最小割
3275: Number Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 748 Solved: 316[Submit][Status][Discus ...
- ZooKeeper分布式集群安装
我特意选择了稳定版...... 奇数意思是说奇数和偶数对故障的容忍度是一致的....所以建议配置奇数个,并不是必须奇数... 一.master节点上安装配置 1.下载并解压ZooKeeper-3.4. ...
- springMVC-数据的格式化
1.配置annotation-driven <mvc:annotation-driven ></mvc:annotation-driven> 2.在实体类上加上@NumberF ...
- 【poj3342】 Party at Hali-Bula
http://poj.org/problem?id=3342 (题目链接) 题意 给出一棵树,要求在不存在两个节点相邻的条件下,选出尽可能多的节点,并且判断是否有多种选法. Solution 很水的树 ...
- C++开发的数据库连接查询修改小工具
项目相关地址 源码:https://github.com/easonjim/SQL_Table_Tool bug提交:https://github.com/easonjim/SQL_Table_Too ...
- Algorithmic Graph Drawing in TikZ
最近在写模板时需要画个图 ("图论"的"图"). 本来打算用Windows画图 (mspaint) 的, 但是效果不好, 还是决定用LaTeX的TikZ画. 这 ...