重新加载轮播项目
我需要从我的传送带中重新加载项目(我单击了一个项目,一个面板被破坏,然后当我尝试返回时,我需要重建传送带)
为此,我通过执行以下操作删除传送带的项目:
var len = cards.length;
for(var c = 0; c < len;c++)
this.myCarousel[0].items.remove(cards[0]);
然后我再次设置卡片并再次设置轮播项目:
this.myCarousel[0].items.append(cards);
this.doLayout();
但是这样做之后,卡片没有设置正确,它们只是写在彼此之上,没有完成轮播效果。此外,卡片开始在轮播的工具栏下绘制,而不是在工具栏下方开始绘制。
第一次加载卡片时,它工作得很好(当我从头开始构建轮播时),但是如果我删除以前的卡片并再次添加它们,它们将无法正确显示,我希望有人可以帮助我。
先感谢您
I need to reload the items from my carousel (I clicked on an item and a panel gets destroyed, then when I try to go back, I need to rebuild the carousel)
For this I am removing the items of the carousel by doing:
var len = cards.length;
for(var c = 0; c < len;c++)
this.myCarousel[0].items.remove(cards[0]);
then I set the cards again and set the carousel items again:
this.myCarousel[0].items.append(cards);
this.doLayout();
but after doing this, the cards dont get set right, they just get written on top of each other, no carousel effect gets done. Also the cards start being drawn under the carousel's toolbar, instead of starting below the toolbar.
The first time when I load the cards it works perfectly (when I build the carousel from scratch), but if I delete the previous cards and add them again, they don't get displayed properly, I hope someone can help me.
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在轮播本身上进行添加和删除,因为它有方法来执行此操作:
如果当您运行上述命令时用户位于不同的卡上(例如,如果您将其放入方向检查中),那么您应该将它们返回到正确的位置像这样的卡:
您必须使用索引,因为该项目将被删除。
Do the adding and removing on the carousel itself as it has methods to do this:
If the user was at a different card when you run the above (say, if you put this into an orientation check) then you should return them to the correct card like so:
You have to use the index as the item will be removed.
id 只能用于调试。有比使用 id 更好的方法来解析组件,这可能会给您带来麻烦。
id should only be used for debugging. There are better ways to resolve a component than use id that can get you into trouble.