Commit 9a88a27b authored by 田翔's avatar 田翔

fix: 生成ID修改

parent 703fdbba
Pipeline #80003 passed with stages
...@@ -3,9 +3,18 @@ import { useDrag, useDrop, DndProvider } from 'react-dnd' ...@@ -3,9 +3,18 @@ import { useDrag, useDrop, DndProvider } from 'react-dnd'
import { GlobalStore } from '../index' import { GlobalStore } from '../index'
import styles from './index.less' import styles from './index.less'
const getNanoid = (len = 10) => {
var orgStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let returnStr = "";
for (var i = 0; i < len; i++) {
returnStr += orgStr.charAt(Math.floor((Math.random() * orgStr.length)));
}
return `${returnStr}`
}
const Group = (props) => { const Group = (props) => {
const id = new Date().getTime() const id = getNanoid()
const ref = useRef(null) const ref = useRef(null)
const [{ dragging }, drag, dragPreview] = useDrag({ const [{ dragging }, drag, dragPreview] = useDrag({
...@@ -45,7 +54,7 @@ const Group = (props) => { ...@@ -45,7 +54,7 @@ const Group = (props) => {
const Card = (props) => { const Card = (props) => {
const ref = useRef(null) const ref = useRef(null)
const id = new Date().getTime() const id = getNanoid()
const [{ dragging }, drag] = useDrag({ const [{ dragging }, drag] = useDrag({
type: 'card', type: 'card',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment