我的反应状态数组中几乎没有值通过 props 传递给当前组件。但我不想像下面的代码中当前显示的那样显示,而是想使用文件系统中的 PDF 模板。
因此,我的预期结果是能够在给定 (x,y) 坐标的原始 PDF 副本上从状态(文本或图像)绘制给定数据,并能够通过电子邮件发送新 PDF 或将其保存到本地存储设备。下面给出的是我现有的代码,它仅显示容器中的数据。
export class FormReview extends Component{
constructor(props) {
super(props);
this.state = {value:0};
}
/*methods used to navigate between multistep forms*/
continue = e => {
e.preventDefault();
this.props.nextStep();
}
back = e => {
e.preventDefault();
this.props.prevStep();
}
render() {
const {values} = this.props;
return(
<MuiThemeProvider>
<React.Fragment>
<AppBar title="Review Submission"/>
<div>
<Grid container spacing={2} style={{padding:50}}>
<Grid item xs={1}/>
<Grid item xs={10}>
<Paper>
<Grid item xs={12} sm container>
<Grid item xs container …Run Code Online (Sandbox Code Playgroud) 我正在使用 alice-carousel ( https://github.com/maxmarinich/react-alice-carousel/blob/master/README.md )制作轮播组件,但在自定义箭头时遇到问题。代码如下
export const Carousel: React.FC<CarouselProps> = ({text }) => {
const [activeIndex, setActiveIndex] = useState(0);
const items = ["item1","item2","item3"]
const slidePrev = () => {
activeIndex==0?(
setActiveIndex(items.length-1)):
setActiveIndex(activeIndex - 2);
};
const slideNext = () => {
activeIndex==items.length-1?(
setActiveIndex(0))
: setActiveIndex(activeIndex + 2)
};
return(
<div className="grid grid-cols-3">
<div className="col-span-2>
{text}
</div>
<div className="flex justify-end">
<button className="px-8" onClick={slidePrev}><ArrowL/></button>
<button className="px-8" onClick={slideNext}><ArrowR/></button>
</div>
<div className="col-span-3 px-10">
<AliceCarousel
mouseTracking
disableDotsControls
disableButtonsControls
activeIndex={activeIndex}
items={items}
responsive={responsive}
controlsStrategy="responsive"
autoPlay={true}
autoPlayInterval={5000}
infinite={true} …Run Code Online (Sandbox Code Playgroud)