kidjp85 / react-id-swiper

A library to use idangerous Swiper as a ReactJs component which allows Swiper's modules custom build
https://react-id-swiper.ashernguyen.site/
MIT License
1.49k stars 154 forks source link

Not recommended 建议不要使用 #431

Open daydayhappychao opened 4 years ago

daydayhappychao commented 4 years ago

昨天用了这个包,根据文档提示,使用renderPagination来设置页码按钮,可是并不生效,并没有执行该方法,查看该仓库的代码后,发现了 https://github.com/kidjp85/react-id-swiper/blob/6738ae81815eb389096dcf9dcc4455621b62936b/src/ReactIdSwiper.tsx#L180

{pagination && pagination.el && renderPagination && renderPagination(props)}

其中pagination与renderPagination都是取得props中的值,而查询代码可以发现pagination除了在这里用于前置判断外没有其他用途,而.d.ts中props并没有这个字段,导致renderPagination不生效。 这是我遇到的一个坑,不知道别的还有多少坑,建议谨慎使用。

I used this package yesterday. According to the documentation, I used renderPagination to set the page number button, but it did not take effect, and the method was not implemented. After checking the code of the warehouse, I found https://github.com/kidjp85/react-id-swiper/blob/6738ae81815eb389096dcf9dcc4455621b62936b/src/ReactIdSwiper.tsx#L180 ` {pagination && pagination.el && renderPagination && renderPagination (props)} ` Among them, pagination and renderPagination both get the value in props, and the query code can find that pagination has no other purpose except for pre-judgment here, and props does not have this field in .d.ts, which renderPagination does not take effect. This is a problem I encountered. I don't know how many other problem there are. I recommend using it with caution.

murphy-wei commented 3 years ago

后悔没有早点看到 凎