Small program swiper spacing effect

describe

I haven’t written a small program for a long time. Today I encountered a problem. How does the swiper of the small program realize the spacing carousel?
Similar to the following effect, the yellow part is the content and the gray is the spacing
insert image description here

I set a margin for each swiper-item and found that it didn’t work. I went to the documentation to read the attributes of the swiper and insert image description here
tried this too. Maybe my calculations were wrong, and it didn’t work at all!
However, I thought of a way that is easier to implement but easily overlooked!

solve

I have been thinking about the question for a long time, but I am just a little bit less spiritual!
The answer is, wrap another layer of view to reduce the width!
insert image description here
I'm such a genius!

Guess you like

Origin blog.csdn.net/weixin_54858833/article/details/124081864