jd-opensource / jd-opensource/nutui

showToast支持teleport

Open
#3,179 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
6.5k
Forks
835
PR merge metrics
No merged PRs in 30d

Description

### NutUI 包名

@nutui/nutui

### NutUI 版本号

4.3.12

### 平台

h5

### 重现链接

### 重现步骤

目前Toast文档没有写支持teleport,看源码创建命令组件是个统一的方法支持teleport,所以showToast传了teleport也有效果,但是Toast在关闭的时候clearToast方法会抛出异常。

### 期望的结果是什么?

showToast支持teleport配置,能正常关闭不报错。

### 实际的结果是什么?

https://github.com/jdf2e/nutui/blob/6d479bc76ab17927f63ac5ffe811690f79c94410/src/packages/__VUE/toast/index.ts#L35
https://github.com/jdf2e/nutui/blob/6d479bc76ab17927f63ac5ffe811690f79c94410/src/packages/__VUE/toast/index.ts#L41

传teleport时 document.body.removeChild(container) 报错

### 环境信息

_No response_

### 其他补充信息

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.