[Partly re-render]

This commit is contained in:
CPunisher 2020-05-03 22:46:47 +08:00
parent d32a40a7a6
commit 7b812f3469
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,10 @@ class QrItem extends React.Component {
this.props.onSelected(this.props.index); this.props.onSelected(this.props.index);
} }
shouldComponentUpdate(nextProps, nextState, nextContext) {
return nextProps.selected || this.props.selected
}
render() { render() {
return ( return (
<div className={calClassName(this.props)} onClick={this.handleClick}> <div className={calClassName(this.props)} onClick={this.handleClick}>

View File

@ -163,7 +163,7 @@ class Qrcode extends React.Component {
<div className="Qr-titled"> <div className="Qr-titled">
<div className="Qr-Centered title-margin"> <div className="Qr-Centered title-margin">
<div className="Qr-s-title">Downloads</div> <div className="Qr-s-title">Downloads</div>
<p className="Qr-s-subtitle">下载二维码</p> <p className="Qr-s-subtitle">下载二维码 - {styleList[this.state.selectedIndex].value}</p>
</div> </div>
<div className="Qr-Centered"> <div className="Qr-Centered">
<div className="div-btn"> <div className="div-btn">