React 组件组件 WillUnmount 不会被调用
我注意到在我的组件定义中,我正在做 'reactRoot.render(<>{reactEl} </>)' 在onRender()中,我之前遗漏了补充 'root.unmount()' n remove() 方法
阅读下方完整回答 ↓问题
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? Chrome 108.0.5359.125(Windows)可复制演示链接 https://codesandbox.io/s/white-meadow-o56l2d?file=/src/Chart/Chart.js:135-254 这个演示不在最新的 grapesjs 版本里,但在本地使用最新版本时,我遇到了同样的 bug描述一下那个虫子 如何复现这个漏洞?访问此[链接](https://codesandbox.io/s/white-meadow-o56l2d?file=/src/Chart/Chart.js:135-254)打开控制台拖拽“图表”方块到身体检查“已创建图表”是否被记录删除图表“图表移除”未被记录。 预期的行为是什么? 当组件被删除时,应调用 ReactComponent.componentWillUnmount() / componentWillUnmount 功能组件 目前的行为是什么? ReactComponent.componentWillUnmount 没有被调用,但调用了 mount。行为准则[X] 我同意遵守本项目的行为准则
回答(2)
我注意到在我的组件定义中,我正在做 'reactRoot.render(<>{reactEl} </>)' 在onRender()中,我之前遗漏了补充 'root.unmount()' n remove() 方法
谢谢你举报,@eduardocalixtokorp。 关于React componentscomponentWillUnmount不叫的好问题。推荐的组件方法是使用事件驱动的API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:...
相关问答
通过相似的问题讨论继续研究。
问题 #4851
This.on('change:attributes:type', this.handleTypeChange)不支持数组类型
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? Chrome 108.0.5359.125可复制演示链接 https://codesandbox.io/s/frosty-darkness-7po7xl描述一下那个虫子 如何复现这个漏洞?使用 myB...
问题 #4906
Grapesjs 在通过脚本设置 innerHTML 时无法识别组件类型。
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v108.0.5359.98 可复制演示链接 https://codesandbox.io/s/grapes-js-template-literal-forked-6kgvrb?fi...
问题 #3806
添加视频时目标为零
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome新版本 可复制演示链接 https://codesandbox.io/s/react-redux-toolkit-application-forked-l5rhp?file=/src/...
问题 #3939
在预览中禁用拖放功能
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? 第95卷可复制演示链接 https://codesandbox.io/s/grapes-border-issue-forked-2c0ib?file=/src/index.js:10258-10261...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners — this post is for you.
教程
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
教程
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
浏览插件分类
直接跳转到市场上的插件分类页面。