Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spaceBetween supported value of percentage as String, but type only allow Number #6286

Closed
chunglam2525 opened this issue Dec 30, 2022 · 0 comments

Comments

@chunglam2525
Copy link

It seems spaceBetween allow percentage as string to be enter:

if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = (parseFloat(spaceBetween.replace('%', '')) / 100) * swiperSize;
}

But spaceBetween type restricted to number or undefined:

/**
* Distance between slides in px.
*
* @default 0
*
* @note If you use "margin" css property to the elements which go into Swiper in which you pass "spaceBetween" into, navigation might not work properly.
*/
spaceBetween?: number;

which cause some type warning, here is the warning in vue
[Vue warn]: Invalid prop: type check failed for prop "spaceBetween". Expected Number with value NaN, got String with value "5%"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant