帖子
帖子
用户
博客
课程
显示全部楼层
12
帖子
0
勋章
79
Y币

[多端开发] 请问下高级组件的轮播图怎么更换

[复制链接]
发表于 2022-7-22 17:03:51
高级组件里面的轮播图我要怎么动态的更换图片,我把图片的路径给icon参数报错
hocSwiperSgmList: [{
                title: "拼团4",
                icon: "http://a346b1014469c58049d5.qiniucdn.apicloud**.**/apicloud/0a26deb65cb6e537a5e619241d382ecc.png"
            }, {
                title: "222",
                icon: "http://a346b1014469c58049d5.qiniucdn.apicloud**.**/apicloud/746f329fbe1b3791e49072c8a05ec60e.png"
            }, {
                title: "333",
                icon: "http://a346b1014469c58049d5.qiniucdn.apicloud**.**/apicloud/521010247ff5852fe77dff5a943e6d97.png"
            }, {
                title: "111",
                icon: "http://a346b1014469c58049d5.qiniucdn.apicloud**.**/apicloud/0a26deb65cb6e537a5e619241d382ecc.png"
            }],
                          




                                                                                                                                          
          var _this= this;
            var ppid= api.pageParam.id;
            console.log(ppid);
            api.ajax({
                urlreq.config.host+'/system/project/'+ppid,
                method:"get",
                 headers: {
                    'Authorization': "Bearer " + api.getGlobalData({ key:'usertoken'})
                 },
            }, function(ret, err){
                //console.log(JSON.stringify(ret));
                _this.data.detalis=ret.data;
                _this.hocSwiperSgmList.icon=$req.config.host+ret.data.imageUrl
                console.log(JSON.stringify(_this.data.detalis));
                // if(ret.code="200"){

                // }
            })
报下面的错误,请问有大佬可以讲解下吗
dispatch script failed. TypeError: Cannot set property 'icon' of undefined at details2.js:578





你这个用的是拼团的源码把,你把你请过来的图片地址,拼装成源码里的格式,赋值就可以了
12
帖子
0
勋章
79
Y币
_this.hocSwiperSgmList.icon=$req.config.host+ret.data.imageUrl 赋值了 但是用报错
错误信息提示你变量未定义了,变量要提前定义,你自己查看下,而且你的代码不全,看不出来
您需要登录后才可以回帖 登录

本版积分规则