backgroundWe can use react-color to implement the color picker of the front-end interface, as shown in the following figure: Install
useimport React, { Component, Fragment, createRef } from 'react'; import { Popover } from 'antd'; import { SketchPicker } from 'react-color'; type StateType = { subtitleColor: string; }; type PropType = { [propName: string]: any; }; interface HandleCreateVideoByHotNews { state: StateType; props: PropType; } class HandleCreateVideoByHotNews extends Component { constructor(props: any) { super(props); this.state = { subtitleColor: '#FFF', } } // Change the subtitle font color private setSubtitleFontColor = (e: any): void => { console.log(e); this.setState({ subtitleColor: e.hex, }); } render() { const { subtitleColor } = this.state; return ( <Popover content={<SketchPicker color={subtitleColor} onChange={(e) => {this.setSubtitleFontColor(e)}} onChangeComplete={(e) => {this.setSubtitleFontColor(e)}} />} trigger="click" > <div className="create-hotnews-video-popup-operate-item-titleset-item-operate font-color-set"> <div className="font-color-set-value">{subtitleColor}</div> <div className="font-color-set-show" style={{backgroundColor: subtitleColor}}></div> </div> </Popover> ) } } export default HandleCreateVideoByHotNews; This is the end of this article about using react-color to implement a front-end color picker. For more related ct-color front-end color picker content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! |
<<: Teach you how to implement a circular/fan-shaped menu in 2 minutes (basic version)
>>: Detailed analysis of compiling and installing vsFTP 3.0.3
Record the installation and configuration method ...
【Foreword】 Both Vue and React's CSS modular s...
Table of contents Tutorial Series 1. Introduction...
Table of contents Skeleton screen use Vue archite...
ps: Here is how to disable remote login of root a...
In an article a long time ago, I talked about the...
Generally, during the development process, the su...
This article is from the Apache Spark Meetup held...
<br />Original text: http://andymao.com/andy...
Preface Recently I found that my friend's met...
Table of contents rem vw Adapt to third-party UI ...
I remember that a few years ago, there was an int...
Table of contents MAH 1. Introduction to MAH Arch...
Preface Today I will share with you a holy grail ...
1. Enter the host machine of the docker container...