Javascript sencha图像url如何显示在我的旋转木马上

Javascript sencha图像url如何显示在我的旋转木马上,javascript,extjs,sencha-touch-2,Javascript,Extjs,Sencha Touch 2,我遇到了一个问题,控制台说找不到我的图像url。但当我直接在carousel items html src中编写时,它显示得很好,但当我使用carousel.add在json中使用数据时,它不起作用 我已经找到了原因:图像url是正确的,但当它通过过程中。图像url将自动添加一个“/”字符在最后,所以不能显示。我能做什么 我的控制器代码: Ext.define('ylp2p.controller.loadpic',{ extend: 'Ext.app.Controller', launch: f

我遇到了一个问题,控制台说找不到我的图像url。但当我直接在carousel items html src中编写时,它显示得很好,但当我使用carousel.add在json中使用数据时,它不起作用

我已经找到了原因:图像url是正确的,但当它通过过程中。图像url将自动添加一个“/”字符在最后,所以不能显示。我能做什么

我的控制器代码:

Ext.define('ylp2p.controller.loadpic',{
extend: 'Ext.app.Controller',
launch: function(){
    var storeId = Ext.create('ylp2p.store.picstore');
    var imagecarousel = Ext.getCmp('imagecarousel');
    storeId.load({
        callback: function(records,operation,success){
            Ext.each(records,function(record){
            imagecarousel.add({html: '<img src='+record.get('url')+'/>'});---is it right?
            });
        }
    });
}
});
我的json代码:

{
"image" : [
        {"name" : "cat", "url": "http://bleachthemind.files.wordpress.com/2010/08/cute-bunnys-domestic-animals-2785589-1024-768.jpg"},
        {"name" : "lion", "url": "http://images1.fanpop.com/images/photos/2600000/Cheetah-Family-wild-animals-2603080-1280-1024.jpg"},
        {"name" : "cat", "url": "http://bleachthemind.files.wordpress.com/2010/08/cute-bunnys-domestic-animals-2785589-1024-768.jpg"}        
]
}
控制台说,

"GET https://bleachthemind.files.wordpress.com/2010/08/cute-bunnys-domestic-animals-2785589-1024-768.jpg/ 404 (Not Found)"
使用此选项并检查

imagecarousel.add({ html: '<img src = ' + record.get('url') + '></img>' });
imagecarousel.add({html:'});
我明白了

imagecarousel.add({html: '<img src='+record.get('url')+' height="100%" width="100%"/>'});
imagecarousel.add({html:'});

它可以工作!但是图像不能像直接显示集html的src值那样,图像不能自动调整大小?如果我的答案对你有帮助,根据你的帖子,身高和体重只是后来的问题,那么请检查这个答案是否正确。没有帮助。哈哈。答案和我以前的答案一样,你应该考虑在URL周围添加正确的引号:<代码> 。使用单引号作为JavaScript字符串连接引号,使用双引号作为HTML属性值引号。按正确的顺序使用引号将使您的HTML有效,并有助于跨浏览器兼容性。我不知道为什么当我使用这种格式时,我的chrome旋转木马无法自动调整图像大小
imagecarousel.add({html: '<img src='+record.get('url')+' height="100%" width="100%"/>'});