javascript - 反应弹簧不起作用让卡滑下来
问题描述
我是新手,我正在尝试使用 react-spring 向下滑动我的 div 元素。但是滑下效果不起作用。我在教程中看到了这一点,并试图实现它,但它不起作用。
这是我的代码:
<Spring from={{ opacity: 0, marginTop: -500 }} to={{ opacity: 1, marginTop: 0 }}>
{props => (
<div style={props}>
<div style={{ display: cost ? 'block' : 'none' }}>
<Card className="calculation shadow">
<CardBody>
<div style={{ borderTop: '2px solid #000 ', marginLeft: 20, marginRight: 20
}}></div>
<Row style={{ float: 'right', marginBottom: '1rem' }}>
<span style={{ float: 'right' }}>
<FontAwesomeIcon icon={faClipboardList} onClick={this.handler} />
</span>
</Row>
<Row style={{ marginTop: '1rem', marginLeft: '3rem', marginBottom: '1rem'
}}>
<h4>
<strong>Normal Freight:</strong> Rs{rate[destination]}/ton
</h4>
</Row>
<Row style={{ marginLeft: '3rem', marginBottom: '1rem' }}>
<h4>
<strong>Volume:</strong> {volume} tons
</h4>
</Row>
<Row style={{ marginLeft: '3rem', marginBottom: '1rem' }}>
<h4>
<strong>Special Freight:</strong> Rs{1.3 * rate[destination]}/ton
</h4>
</Row>
<Row style={{ marginLeft: '3rem', marginBottom: '1rem' }}>
<h4>
<strong>Delta Price:</strong> Rs{1.3 * rate[destination] -
rate[destination]}{' '}
</h4>
</Row>
<Row style={{ marginLeft: '3rem', marginBottom: '1rem' }}>
<h4>
<strong>Cost Impact:</strong> Rs{(1.3 * rate[destination] -
rate[destination]) * volume}
</h4>
</Row>
<div style={{ borderTop: '2px solid #000 ', marginLeft: 20, marginRight: 20
}}></div>
</CardBody>
</Card>
</div>
</div>
)}
</Spring>
如何使其工作,以便 div 组件在单击按钮时向下滑动。请帮忙
解决方案
推荐阅读
- wordpress - Wordpress:邮件程序错误:无法实例化邮件功能
- java - 记录休眠查询 - 在 log4j.properties 和 persistence.xml 中设置?
- java - 未调用子类实体上的实体侦听器回调
- azure - 在 Azure API 管理开发人员门户的自定义页面中获取登录用户
- google-bigquery - 如何从 BigQuery 中提取表定义
- symfony - symfony 3:如何在表单类型的 addEventSubscriber 中获取更新的数据?
- php - 如何在 wordpress 的自定义元框中添加帖子类别
- android - Android - 如何覆盖 onBackPressed 方法但仍使用默认动画?
- google-apps-script - 当用户开始输入时计算文档中的单词
- java - HTML 和 CSS 中的 Apache Wicket 实时预览更改