javascript - Material UI 中的幻灯片来自屏幕边缘
问题描述
Slide in Material UI 过渡从屏幕边缘开始,有什么办法可以限制卡片组件内部的交易。我已经发布了下面的代码来强调这个问题。我的目标是确保过渡在组件边界内开始和结束
例如在下面的代码中,我希望转换在卡片 Material UI 组件中开始和结束
import React from 'react';
import Card from '@material-ui/core/Card';
import { IconButton, CardContent, Slide, Paper } from "@material-ui/core";
import { Settings } from "@material-ui/icons"
import { withStyles } from '@material-ui/core/styles'
const styles = {
card: {
minWidth: 560,
},
cardContent: {
padding: 8,enter code here
display: 'flex',
justifyContent: 'flex-end'
},
smallIcon: {
width: 36,
height: 36,
padding: 0,
},
paper: {
width: "400px",
height: "320px",
zIndex: 1,
position: "absolute",
backgroundColor: "#000000",
top: "20%",
}
}
class SimpleCard extends React.Component {
// eslint-disable-next-line no-useless-constructor
constructor(props) {
super(props)
this.state = {
gearIconClick: ""
}
}
chartFilterSlider = (evt) => {
debugger
var clicked = evt.currentTarget.translate
console.log("clicked", clicked)
this.setState({
gearIconClick: clicked
})
}
render() {
const { classes, } = this.props
const { gearIconClick } = this.state
//console.log("gearIconClick",gearIconClick)
return (
<Card className={classes.card}>
<CardContent className={classes.cardContent} >
<IconButton className={classes.smallIcon} onClick={this.chartFilterSlider}>
<Settings />
</IconButton>
{gearIconClick ?
<Slide direction="left" in={true} mountOnEnter unmountOnExit>
<Paper elevation={4} className={classes.paper}>
hello
</Paper>
</Slide>
:
<div></div>
}
</CardContent>
{this.props.children}
</Card>
);
}
}
export default withStyles(styles)(SimpleCard)
Excepted :
Is there any way we can limit the transaction inside the card component.
Actual output:
Slider in Material UI comes from the edge of the screen
解决方案
添加overflow: hidden
到Card
,它应该可以完成这项工作。
推荐阅读
- flutter - 没有为类“MyHomePage”定义方法“Main”
- c# - 使用未知数量的参数调用一些方法
- python - 使用哪个深度学习框架来生成预测图像
- python - 通过 webscoket 从 python 打印中的代理 api 更新后显示为零的所有数据值包含 0,0,0,0,0
- css - 如何在 BOOTSTRAP 4 列之间添加空格
- django - Django CBV post 函数中是否有一种方法可以将信息添加到上下文中
- kubernetes - 没有在 Kubernetes 工作节点上提供配置
- python - 无法获取上传的文件并下载它。烧瓶
- linux-kernel - 为什么 Linux 偏爱 0x7f 映射?
- javascript - Javascript - 使用字符串创建输入按钮 - 调用函数 onclick 的问题