From f68e20296af31d165c03a9aee93b03855f488891 Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Sun, 26 Sep 2021 15:26:48 +0800 Subject: [PATCH] addon web: copied state --- addon/web/client/src/components/ViewFlow.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addon/web/client/src/components/ViewFlow.tsx b/addon/web/client/src/components/ViewFlow.tsx index 1d0f685..68841eb 100644 --- a/addon/web/client/src/components/ViewFlow.tsx +++ b/addon/web/client/src/components/ViewFlow.tsx @@ -17,6 +17,7 @@ interface Iprops { interface IState { flowTab: 'Headers' | 'Preview' | 'Response' + copied: boolean } class ViewFlow extends React.Component { @@ -25,6 +26,7 @@ class ViewFlow extends React.Component { this.state = { flowTab: 'Headers', + copied: false, } } @@ -98,7 +100,7 @@ class ViewFlow extends React.Component { { !(flowTab === 'Headers') ? null :
-

+ + this.setState({ copied: true }, () => { + setTimeout(() => { + this.setState({ copied: false }) + }, 1000) + }) + + }}>{ this.state.copied ? 'Copied' : 'Copy as cURL' }

General