亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

? ? ????? JS ???? dnd-kit? ???? ?? ?? ??? ? ?? ?? ?? ??

dnd-kit? ???? ?? ?? ??? ? ?? ?? ?? ??

Dec 10, 2024 pm 08:09 PM

?????. ? ??? ??????.

?? ?? ??? ?????? 17.5k ?? ?? ????? PMP? ?????. ??? Notion ???? ?????? ?? ????
React Nextjs ? Supabase? ???? AI ?? ? ??? ???? HuashuiAI.

? ???? React? dnd-kit?? ?? ??? ?? ??? ??? ? ??? ???? ??? ???????. ???? ??? ? ??? ????.

React   dnd-kit, implement tree-list drag and drop sortable

Dnd-kit ? Sortable ?? ??

Dnd-kit? React ????? ?? ???? ??? ? ?? ???? ????? ?? ??? ?????.

    <DndContext 
      sensors={sensors}
      collisionDetection={closestCenter}
      onDragEnd={handleDragEnd}
    >
      <SortableContext 
        items={items}
        strategy={verticalListSortingStrategy}
      >
        {items.map(id => <SortableItem key={id}>



<p>But it can only support the one-level list. If we want to implement a multi-level nested list (or tree), we have to customize it.</p>

<h2>
  
  
  Define state date structure
</h2>

<p>Modern front-end frameworks such as React Vue are data-driven views, so defining data structures first and then considering UI rendering.</p>

<p>The most common data structure definition for multi-level nested lists (trees) is as follows, and virtual DOM vnode is also defined in this way.<br>
</p>

<pre class="brush:php;toolbar:false">const defaultItems = [
  { id: 'A', children: [] },
  {
    id: 'B',
    children: [
      { id: 'B1', children: [] },
      {
        id: 'B2',
        children: [
          { id: 'B2a', children: [] },
          { id: 'B2b', children: [] },
        ],
      },
    ],
  },
  { id: 'C', children: [] },
  {
    id: 'D',
    children: [
      { id: 'D1', children: [] },
      { id: 'D2', children: [] },
    ],
  },
  { id: 'E', children: [] },
]

?? ?? ?? SortableContext? ?? ???? ????.

?? ??? ??? ???? ?? ??? ?? ?? ???? ?? UI ??? ?? ???? ????? ????.

?? ??? , ?? ?? ??? ??? ???? ?? ??? ?????.

React   dnd-kit, implement tree-list drag and drop sortable

?? ?? ?? ???? ???? ??.

React   dnd-kit, implement tree-list drag and drop sortable

?? ??? ??? ????. ??? ??? ?? ???? ??? ? ?? ??? ?????, ????? ??? ??? ?? ?? ??? ?????? ????. ?? ??????

React   dnd-kit, implement tree-list drag and drop sortable

?? ???? ?? ?? ??? ?????.

??? ?????? ?? ??? ?? ??? ???? ???.

??? ?? ?? ??? ??? ???? ? ??? ?? ??? ?? ?? ??? ??? ????? ? ??? ?? ID ??? ???? ???.

interface IItem {
  id: string
  ancestorIds?: string[]
  children?: IItem[]
}

function flatten(items: IItem[]): IItem[] {
  return items.reduce<IItem[]>((acc, item) => {
    acc.push(item)
    if (item.children) {
      const children = item.children.map((i) => ({
        ...i,
        ancestorIds: [...(item.ancestorIds || []), item.id], // add ancestorIds
      }))
      acc.push(...flatten(children))
    }
    return acc
  }, [])
}

?? ? ??? ??? ??? ???, ?? ????? ??? ? ????. ?, ?? ??? ???? ???? ???? ????.

React   dnd-kit, implement tree-list drag and drop sortable

?? ?? ID? ??? ??? ?? ??? ? ??? ??? ??? ? ????. ?? ??? ?? ??? ??? ? ????. ??? ??? ??? ?????.

?? ?? ? ???? B2? B2a? ??? ?????? ?? B2a? ?? ID? B2? ???? ??? ? ? ????. ??? ?? ???? ? ? ?? ??? ?? ??????.

?? ??? ??

??? ???? ?? ???? Zustand ??? ???? ?????.

React   dnd-kit, implement tree-list drag and drop sortable

Dnd-kit? ???? ??? activeItem??, ??? ?? ??? overItem?? ?????. ??? ?? ???? ????? ?? activeItem? overItem? ??? ???? ?? ?????.

?? ??? ?? Dnd-kit??? ?? ??? ? ?? arrayMove ???? ?????. ?? ?? https://docs.dndkit.com/presets/sortable

React   dnd-kit, implement tree-list drag and drop sortable

??? ??? ?? ??(??)??? ?? ?? ???? ???, ?? ?? ??????. ?? ??? ??? ???, ????? ?? ??(?? ? ??)? ????? ? ????.

React   dnd-kit, implement tree-list drag and drop sortable

??? ??????.

?? ??? ?? A? B ??? ????? A? B ??? ?? ????? B ??? ???? ???.

React   dnd-kit, implement tree-list drag and drop sortable

? ??? ????? B ?? B? ?? ??? ??? ???? ???. ???? ?? ?? ??? overItem? ?????

React   dnd-kit, implement tree-list drag and drop sortable

?? ?? ?? ?? ??? ??? ? ?? ??? ?????.

React   dnd-kit, implement tree-list drag and drop sortable

?

???? ??? ?? https://github.com/wangfupeng1988/react-dnd-sortable-demo

???? ?? ???? ?? ??? ?? ????. ??? ??? ? Github ???? ?? ??? ???.

? ??? dnd-kit? ???? ?? ?? ??? ? ?? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1488
72
???
node.js?? HTTP ????? ??? node.js?? HTTP ????? ??? Jul 13, 2025 am 02:18 AM

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ?? : ?? ? ?? JavaScript ??? ?? : ?? ? ?? Jul 13, 2025 am 02:43 AM

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

REACT vs Angular vs Vue : ?? JS ??? ??? ?? ????? REACT vs Angular vs Vue : ?? JS ??? ??? ?? ????? Jul 05, 2025 am 02:24 AM

?? JavaScript ??? ??? ??? ?????? ?? ??? ?? ?? ??? ?? ???? ????. 1. ??? ???? ???? ?? ??? ?? ? ? ???? ??? ??? ?? ? ?? ????? ?????. 2. Angular? ?????? ??? ?? ???? ? ?? ?? ??? ??? ??? ???? ?????. 3. VUE? ???? ?? ??? ???? ?? ?? ??? ?????. ?? ?? ?? ??, ? ??, ???? ???? ? SSR? ???? ??? ??? ??? ???? ? ??? ?????. ???, ??? ??? ??? ????? ????. ??? ??? ??? ??? ?? ????.

JavaScript Time Object, ??? Google Chrome? EACTEXE, ? ?? ? ???? ?????. JavaScript Time Object, ??? Google Chrome? EACTEXE, ? ?? ? ???? ?????. Jul 08, 2025 pm 02:27 PM

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

?? API? ???? ??? ???? ??? ?????? ?? API? ???? ??? ???? ??? ?????? Jul 08, 2025 am 02:43 AM

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

?? ??? : JavaScript? ??, ?? ?? ? ?? ????? ?? ??? : JavaScript? ??, ?? ?? ? ?? ????? Jul 08, 2025 am 02:40 AM

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

??? ??. ?? ????? ??? ????? ??? ?? ?? ??? ??. ?? ????? ??? ????? ??? ?? ?? Jul 06, 2025 am 02:36 AM

.map (), .filter () ? .reduce ()? ?? JavaScript ?? ?? ???? ??? ??? ??? ? ? ????. 1) .map ()? ??? ??? ??? ???? ? ??? ???? ? ?????. 2) .filter ()? ???? ??? ????? ? ?????. 3) .reduce ()? ???? ?? ??? ???? ? ?????. ???? ??? ????? ??? ?? ?? ??? ?????.

JS Roundup : JavaScript ??? ??? ?? ?? ??? JS Roundup : JavaScript ??? ??? ?? ?? ??? Jul 08, 2025 am 02:24 AM

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.

See all articles