baidu / baidu/amis

使用react-dom/client 导致 amis-nav collapse交互失效

Open
#4,801 1 comment 0 reactions 0 assignees View on GitHub
doc need confirm
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 描述问题:

入口文件 使用的ReactDOM.createRoot(document.getElementById('root')!).render() 的渲染方式,
使用 `type: 'nav'` 时,无法收缩 unfold menu。

#### 如何复现(请务必完整填写下面内容):

1. 你是如何使用 amis 的?
```
{
// 这里是 amis 的 Json 配置。
type: 'page',
aside: {
type: 'nav',
stacked: true,
className: 'w-md',
links: [
{
label: 'Nav 1',
to: '/docs/index',
active: true,
},
{
label: 'Nav 2',
unfolded: true,
children: [
{
label: 'Nav 2-1',
children: [
{
label: 'Nav 2-1-1',
to: '/docs/api-2-1-1',
},
],
},
{
label: 'Nav 2-2',
to: '/docs/api-2-2',
},
],
},
{
label: 'Nav 3',
to: '/docs/renderers',
},
],
},
toolbar: [
{
type: 'tpl',
tpl: '这是工具栏部分',
},
],
body: [
{
type: 'tpl',
tpl: '这是内容区',
},
],
},
)}
```

2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
"amis": "^2.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
3. 粘贴有问题的完整 `amis schema` 代码:
```
ReactDOM.createRoot(document.getElementById('root')!).render(





)
```

4. 操作步骤
请简单描述一下复现的操作步骤...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with ReactDOM.createRoot, React 18, and the provided `type: 'nav'` schema. Trace the nav collapse interaction from the reproduction and compare it with the legacy rendering path; done means nested unfold menus can be collapsed when rendered through `createRoot`.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.