From 7b812f34696f56f03cc15a293606bdc52b92bb6c Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Sun, 3 May 2020 22:46:47 +0800 Subject: [PATCH] [Partly re-render] --- src/components/QrItem.js | 4 ++++ src/components/Qrcode.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/QrItem.js b/src/components/QrItem.js index 272937b..0034d5d 100644 --- a/src/components/QrItem.js +++ b/src/components/QrItem.js @@ -20,6 +20,10 @@ class QrItem extends React.Component { this.props.onSelected(this.props.index); } + shouldComponentUpdate(nextProps, nextState, nextContext) { + return nextProps.selected || this.props.selected + } + render() { return (
diff --git a/src/components/Qrcode.js b/src/components/Qrcode.js index 3de4c29..ad2a12e 100644 --- a/src/components/Qrcode.js +++ b/src/components/Qrcode.js @@ -163,7 +163,7 @@ class Qrcode extends React.Component {
Downloads
-

下载二维码

+

下载二维码 - {styleList[this.state.selectedIndex].value}