- Notifications
You must be signed in to change notification settings - Fork750
fix(accordion): Accordion组件默认开启的状态时 state wrapperHeight 初始设置为0会导致动画错误#1036
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:dev
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
b2nil commentedSep 21, 2020
问题如果一个页面使用了两个以上 当第一个 当第一个 privatetoggleWithAnimation():void{const{ open, isAnimation}=this.propsif(!this.isCompleted||!isAnimation)returnthis.isCompleted=falsedelayQuerySelector(this,'.at-accordion__body',0).then(rect=>{constheight=parseInt(rect[0].height.toString())...})} 建议可以在这里加一个动态 id: <Viewid="{uniqueDynamicID}"className='at-accordion__body'>{this.props.children}</View> 然后在 delayQuerySelector(this,`#{uniqueDynamicID}.at-accordion__body`,0).then(rect=>{constheight=parseInt(rect[0].height.toString())...}) |
yuwangjuan commentedAug 16, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
添加.at-accordion__content的height:auto !important 覆盖原本height,亲测有效 |
wrapperHeight默认值 0时,toggleWithAnimation设置startHeight时 会导致css3错误触发动画;现在的示例第二个就有这个问题:https://taro-ui.jd.com/#/docs/accordion 。
fix: 将组件的state wrapperHeight 默认值设置为 ’unset‘,可以防止toggleWithAnimation方法设置初始高度是错误的出现动画。
希望采纳,或者用更优雅的方式解决下,谢谢