Skip to content

Instantly share code, notes, and snippets.

View zhangshuo00's full-sized avatar
🎯
Focusing

zhangshuo zhangshuo00

🎯
Focusing
View GitHub Profile
@zhangshuo00
zhangshuo00 / click&doubleClick.jsx
Created January 9, 2024 07:56
Bind both click and doubleClick events on a component simultaneously, and no longer trigger click events when double clicking.
import { Button, message } from "antd"
const ClickComp = (props) => {
let clicks = 0
let clickTimer = null
let clickspan = 300
const handleClick = () => {
clicks++
if (clicks === 1) {
clickTimer = setTimeout(() => {
@zhangshuo00
zhangshuo00 / TagInputCom.tsx
Last active July 8, 2023 09:13
mix Input and Tag from antd, for Form.Item
/**
* @description: mix Input and Tag from antd, for Form.Item
*/
import React, {Fragment, useState} from "react";
import {Input, Tag, Form} from 'antd';
import { PlusCircleOutlined } from '@ant-design/icons';
import { getCharSize } from "./utils";
interface PriceInputProps {
value?: Array<string>;
@zhangshuo00
zhangshuo00 / AntdSingleTree.tsx
Last active June 20, 2023 07:14
antd-tree-singleSelect
/**
* @description: antd-tree-singleSelect
*/
import React, { useEffect, useState } from "react";
import { Tree } from "antd";
import { DataNode } from "antd/es/tree";
const treeData: DataNode[] = [
{
title: "1",