Ant-design-mobile: SwipeAction组件能不能控制滑块的宽度

Created on 24 Jul 2017  ·  7Comments  ·  Source: ant-design/ant-design-mobile

What problem does this feature solve?

默认滑动出来的div是正方形,怎么让滑块根据文字多少自动变宽,自己改变CSS之后,滑块的总长度还是没变

What does the proposed API look like?

希望可以自定义每个滑块的宽度

PR Welcome feature

Most helpful comment

看代码应该是没法根据内容来自适应宽度的,是有点不灵活。

All 7 comments

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: https://github.com/ant-design/ant-design/issues/4897

JS是怎么控制滑块滑动的距离的?即滑块滑动时的CSS的 left 值可以修改吗?

看代码应该是没法根据内容来自适应宽度的,是有点不灵活。

请问能用js控制滑块移动的距离吗?
tim 20170725100023
这个图是滑动后的效果,有四个滑块,本来每个滑块是正方形,我用CSS将宽度改窄了。但是右边多出来一截空白?

很多计算都是根据 这个 width 来做的,如果 width 可以自定义,在计算的时候就会很复杂,而且用户有可能每个 button 还不一样宽的话,就没办法做了;

有兴趣研究的,来 PR https://github.com/react-component/swipeout/blob/master/src/Swipeout.tsx

Was this page helpful?
0 / 5 - 0 ratings