Skip to content

Conversation

@xiao19880917lu
Copy link
Collaborator

No description provided.

const circularShared = useSharedValue(circular)
const children = Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : [])
// 支持swiper-item 同时存在<swiper-item wx:for/>和<swiper-item>并列的情况
const children = (Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : [])).flat()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接走Children.toArray吧

// 记录元素的偏移量
const offset = useSharedValue(getOffset(propCurrent, initStep))
// 记录起始的offset,用于判断是否超过一半(当前offset + 起始或修正起始offset),基于索引判断是否超过一半不可行(1.滑动过程中索引会变更导致计算反向, 2.边界场景会更新offset也会导致基于索引+offset判断实效)
const preOffset = useSharedValue(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥需要这个,超过一半与否用offset%step与step/2比较就可以了吧

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

Successfully merging this pull request may close these issues.

3 participants