- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用此订单时:
<script src="lib/angular/angular.js"></script>
<script src="lib/onsen/js/onsenui.js"></script>
<script src="http://include.jaydata.org/datajs-1.0.3.js"></script>
<script src="http://include.jaydata.org/jaydata.js"></script>
<script src="http://include.jaydata.org/jaydatamodules/angular.js"></script>
我收到此错误
TypeError: Class.extend is not a function
at Object.<anonymous> (onsenui.js:13049)
at Object.invoke (angular.js:4535)
at Object.enforcedReturnValue [as $get] (angular.js:4387)
at Object.invoke (angular.js:4535)
at angular.js:4352
at getService (angular.js:4494)
at Object.invoke (angular.js:4526)
at Object.enforcedReturnValue [as $get] (angular.js:4387)
at Object.invoke (angular.js:4535)
at angular.js:4352
使用此命令时:
<script src="lib/angular/angular.js"></script>
<script src="http://include.jaydata.org/datajs-1.0.3.js"></script>
<script src="http://include.jaydata.org/jaydata.js"></script>
<script src="http://include.jaydata.org/jaydatamodules/angular.js"></script>
<script src="lib/onsen/js/onsenui.js"></script>
注意:已编辑以更正顺序
jaydata.js:3342 Uncaught TypeError: Cannot read property 'apply' of undefined
感谢任何帮助!
最佳答案
看起来 jaydata 和 onsenui 都在使用 window.Class
,但是它们的实现有很大不同。 Onsen 使用 John Resig 的实现,而在 jaydata 的版本中,Class
实际上是其 ClassEngineBase
的一个实例。至少从我的 Angular 来看,使这两个实现协同工作的问题是,在 jaydata 的版本中,Class 实际上是一个实例而不是一个函数。如果它是一个函数,那么只需将扩展方法添加到 jaydata 的实现中即可轻松合并两个实现。
您仍然可以尝试这样做,但这不会那么容易,如果做得不当,可能会出现一些新的错误。
所以你的选择是:
1.序列:[jaydata
, onsenui
, patch
],其中 patch 是 onsenui 版本的修改版本。
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
this.Class.extend = function(prop) {
var _super = this.prototype || {};
initializing = true;
var constructor = typeof this === 'function' ? this : function(){};
var prototype = new constructor();
initializing = false;
for (var name in prop) {
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
this._super = _super[name];
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
function Class() {
if (!initializing && this.init)
this.init.apply(this, arguments);
}
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.extend = arguments.callee;
return Class;
};
})();
但是我还没有真正测试过它是否有效,并且可能存在一些问题。
您没有包含 angular-onsenui.js
,所以我猜您使用的是 onsen 1,而不是 onsen 2。Here是 1.3.15
的稍微修改版本,不应发生冲突(未经测试,抱歉)。
在 JayData 中,他们将类存储在 $data.Class
中,因此事实证明,http://中只有 2 个地方使用了全局类。 include.jaydata.org/jaydata.js
2874: $data.Class = Class = new ClassEngineBase();
3342: global["$C"] = function () { Class.define.apply(Class, arguments); };
您可以从第一行中删除 = Class
并将第二行的两种情况从 Class
更改为 $data.Class
,或者只是在第 2873 行写入 var Class;
。 - 实际上,他们似乎已经有了 implemented this change但好像还没有在线版本。
关于javascript - onsenui 和 jaydata 不能共存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36392774/
我正在用 C 编写一个 shell,它应该支持后台和前台进程。 约束: 终止的后台进程应由信号处理程序捕获 没有全局变量可用于与信号处理程序进行通信 不允许列出进程/pids 我的解决方案: 等待 p
我目前有一个使用 Laravel Framework 使用 PHP/MySQL 构建的应用程序.我想将此应用程序迁移到 Ruby on Rails但我完全拆解/重建是不可行的。我想知道让一个 PHP
我需要使应用程序与所有 NET Framework 兼容:2、3、3.5 和 4。 此外,我想开发一个应用程序,当在仅安装了 Framework 2 的 PC 上执行时,GUI 是使用 Windows
我将在下一个项目中使用 GWT,但我想使用 JQuery 的一些非常好的小部件、组件(一些数据网格)。你觉得可能吗?谢谢! 最佳答案 虽然可以,但最好使用 gwtquery 。它是 JQuery 到
来自网上的定义: Karma: 是一种生成 Web 服务器的工具,该服务器针对连接的每个浏览器的测试代码执行源代码。针对每个浏览器的每个测试的结果都会被检查并通过命令行显示给开发人员。 Jasmine
我已经 read使用 Mono 开发的应用程序使用与 ART 类似的 MonoRuntime 进行部署,解释 C# 代码,执行它们等。我假设 Unity 和 Xamarin 都这样做。 对我来说奇怪的
我确实收到了一项具有挑战性的任务,即将旧的遗留 cakephp 2 应用程序迁移到 laravel 5.2。 两者必须共存并协同工作,同时所有模块都迁移到 laravel,因为它是一个大型应用程序。
我们这里有一个面向客户的大型 Web 应用程序。我们最近重写了在线购买体验,使其更快。我使用 ASP.Net-MVC 的建议没有被采纳,因为我是这里唯一知道这一点的人。 现在我们即将开始重新开发网站的
我总是看到更多的 Java Web 应用程序使用 ORM 框架将实体映射到数据库,并且显然使对象的序列化变得更容易。 这看起来不错,通常涉及很多代码,例如: @Entity @Table(name="
我尝试使用长按手势和配置为连续更新的步进器来设置 View 。长按时,不会出现步进器的连续特征。目前,我已禁用长按。我想我不需要它。但为了将来引用,我将如何允许两者共存? 需要明确的是,这是我尝试此操
我对 NodeJS 还很陌生,并计划为我当前的项目升级 NodeJS 版本。最新的 NodeJS LTS 是使用 NVM 安装的。 我需要不断在当前使用的 LTS 和已安装的新 LTS 之间切换。我知
有谁知道如何让这两个重载运算符共存? #include template class A; template std::ostream& operator& e ); template class A
是否可以在同一个集群中同时运行 Hadoop MR1 和 MR2(至少在理论上)? 如果是,我该怎么做? 最佳答案 理论上,你可以这样做: 在一台机器上运行 DataNode TaskTracker
我有一个遗留应用程序,它使用 spl_autload 来加载类(它们没有命名空间)
让 PHP7 和 PHP 8 共存 我已经从 PHP 7 升级到 PHP 8。就像 PHP 的情况一样,我在 /usr/bin 中仍然有 php7.4| (与 php8.0 一起)。但是,当我运行 p
在这个 Redux: Colocating Selectors with Reducers蛋头教程,Dan Abramov建议使用接受完整状态树而不是状态切片的选择器来封装远离组件的状态知识。他认为这
GCC 的两个版本可以共存: native Windows MinGW 版本和 cygwin linux 版本吗?当在 Cygwin 上系统尝试使用 MinGW 版本的 GCC 进行编译时,就会出现问
我的客户有一个 x64 服务器,他在其中安装了 x32 和 x64 版本的 Oracle 客户端。在他安装我的 Web 应用程序并尝试运行它后,他收到有关 Oracle.DataAccess.dll
我在安装了 IvyDE 的 Eclipse IDE 中运行 Ivy->Resolve 时遇到问题。同时, Ant 目标
我在一个基本上是一堆数据的文件存储库的网站上工作。 我需要人们能够通过 WebDAV 和他们的浏览器(即 mod_autoindex)遍历目录和下载文件。 仅使用 mod_autoindex 和 mo
我是一名优秀的程序员,十分优秀!