Javascript 蓝精灵画廊,带棱角2+;
我最近将JS gallery与angular 2(使用angular cli运行)应用程序集成。我通过NPM(Javascript 蓝精灵画廊,带棱角2+;,javascript,angular,typescript,mobile,blueimp,Javascript,Angular,Typescript,Mobile,Blueimp,我最近将JS gallery与angular 2(使用angular cli运行)应用程序集成。我通过NPM(NPM install blueimp gallery--save)安装了它,并通过.angular cli.json导入了它: "styles": [ "../node_modules/blueimp-gallery/css/blueimp-gallery.css", "../node_modules/blueimp-gallery/css/blueimp-gallery-in
NPM install blueimp gallery--save
)安装了它,并通过.angular cli.json
导入了它:
"styles": [
"../node_modules/blueimp-gallery/css/blueimp-gallery.css",
"../node_modules/blueimp-gallery/css/blueimp-gallery-indicator.css"
],
"scripts": [
"../node_modules/blueimp-gallery/js/blueimp-helper.js",
"../node_modules/blueimp-gallery/js/blueimp-gallery.js",
"../node_modules/blueimp-gallery/js/blueimp-gallery-indicator.js"
]
从这里开始,我在角度组件中使用它:
//from .angular-cli.json
declare const blueimp: any;
public show(event: any, images: any[]) {
const options = {
event: event || window.event,
};
blueimp.Gallery(images, options);
};
到目前为止,一切都很好:效果很好,我可以使用画廊。然而,我最近收到了来自移动设备客户的崩溃报告。我想打开一个github问题,但在blueimp/Gallery github repo上似乎不可能
以下是android设备上经常出现的崩溃:
TypeError: Cannot read property 'style' of undefined
at Gallery.translate (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:492:37)
at Gallery.translateX (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:501:12)
at Gallery.move (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:487:12)
at Gallery.slide (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:339:14)
at eval (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:384:22)
at n.invokeTask (/polyfills.0a60947aabdcee7751c0.bundle.js:36:7074)
at Object.onInvokeTask (/vendor.7a5c4da3f678e71e26f9.bundle.js:261:2558)
at n.invokeTask (/polyfills.0a60947aabdcee7751c0.bundle.js:36:7010)
at t.runTask (/polyfills.0a60947aabdcee7751c0.bundle.js:36:4427)
at invoke (/polyfills.0a60947aabdcee7751c0.bundle.js:36:8187)
at t.args.(anonymous function) (/polyfills.0a60947aabdcee7751c0.bundle.js:15:85)
两个崩溃都在blueimp代码的同一部分。我似乎无法确定地再现这些崩溃,我正在努力修复它们
有没有人在angular 2+上使用过blueimp?有人看到过blueimp Gallery的类似问题吗?看起来错误源是
polyfills.js
-此文件包含的代码填充了缺少浏览器功能的内容。您是否尝试过通过将空图像数组传递给show(事件:any,图像:any[])
函数来复制此错误?
EXCEPTION: undefined is not an object (evaluating 'this.slides[index].style')
translate
translateX
move
slide
invokeTask@/polyfills.0a60947aabdcee7751c0.bundle.js:36:7079
onInvokeTask@/vendor.7a5c4da3f678e71e26f9.bundle.js:261:2568
invokeTask@/polyfills.0a60947aabdcee7751c0.bundle.js:36:7022
runTask@/polyfills.0a60947aabdcee7751c0.bundle.js:36:4437
invoke@/polyfills.0a60947aabdcee7751c0.bundle.js:36:8194