分量阻力事件
就你而言,我觉得最好听内部组件的更改(比如如果我删除所有子组件怎么办?),但目前没有这样的事件,所以我会尝试在下一个版本添加它。应该是这样的 “''js editor.on('component:update:components', component => { 只需修改视图元素即可 const el = component.getEl(); const hasChildren = component.components().length; el.classList[hasChildren ?'remove' : 'add']('component--is-empty'); }) ```
阅读下方完整回答 ↓问题
我想知道如何将该组件拖拽到另一个组件。如果在组件被拖拽到后变空,我需要添加一个类 外部元素。我能找到拖拽的组件和掉落的组件,但不能从拖拽的位置找到。任何帮助都将不胜感激。
回答(3)
就你而言,我觉得最好听内部组件的更改(比如如果我删除所有子组件怎么办?),但目前没有这样的事件,所以我会尝试在下一个版本添加它。应该是这样的 “''js editor.on('component:update:components', component => { 只需修改视图元素即可 const el = component.getEl(); const hasChildren = component.components().length; el.classList[hasChildren ?'remove' : 'add']('component--is-empty'); }) ```
@YashPrince你是怎么获得被拖拽组件的ID,以及它被丢弃在哪里的?
由于关闭后没有近期活动,该帖子已被自动锁定。请为相关漏洞开启新一期。
相关问答
通过相似的问题讨论继续研究。
问题 #1434
工具栏隐藏文本元素
@artf 请检查你的演示页面文字是否隐藏在工具栏下方。我们如何更新工具栏的位置?  : ![captura de pantalla 2017-10-27 a las 17 23 49](https://user-images.githubusercontent.com/1...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
Super Tooltip for GrapesJS — Version 0.1.5 Released 🎉
We’re excited to announce the v 0.1.5 update of Super Tooltip, our floating‑menu and tooltip plugin for GrapesJS
教程
GrapesJS in 2026: The Complete Guide to the Open-Source Web Builder Framework
Master GrapesJS in 2026. Architecture, code examples, React integration, plugin development, Studio SDK, and how it compares to other projects
浏览插件分类
直接跳转到市场上的插件分类页面。