Component Value is not changing
谢谢你举报,@Abhisheknanda1344463。 关于组件价值没有变化的好问题。ProseMirror 推荐的方法是使用事件驱动的 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => console.log('component...
阅读下方完整回答 ↓问题
你好@artf 我添加了一个新组件 这是代码 “''js 编辑。DomComponents.addType('header', { 型号:{ 默认值:{ 标签名称:'h1', 类型:“头部”, 尺寸:“H1”, 特质:[ { 名称:“尺寸”, 标签:“尺寸”, 类型:“选择”, 变革提案:1, 选项:[ {值:'h1',名称:'One'}, {值:“h2”,名称:“二”}, {值:'h3',名称:'三'}, ] } ], 内容:“请在此插入你的头文字” }, init(){ this.listenTo(this, 'change:size', this.更新头); }, Updatehead(){ var newElem = $('<'+this.changed['size']+ ' />').append(this.view.el.innerText); console.log(newElem.html()); this.view.model.set('content',newElem.html()); this.view.el.innerHTML = newElem.html(); this.attributes.tagName = this.changed['size']; this.attributes.size = this.changed['size']; } } }...
回答(1)
谢谢你举报,@Abhisheknanda1344463。 关于组件价值没有变化的好问题。ProseMirror 推荐的方法是使用事件驱动的 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => co...
相关问答
通过相似的问题讨论继续研究。
问题 #3225
How to Update Style from checkbox Trait?
你好@artf 我尝试用复选框特性更新样式,但它没有调用函数。 这是代码 非常感谢你能提供的任何见解! 谢谢
问题 #3688
How to customize a component
我 https://grapesjs.com/docs/modules/Components.html#define-custom-component-type 读了这份文档,并尝试编写以下代码。我想让“mj-body”无法删除: 但我看不到效果,请帮帮我
问题 #3137
当我选择某个特定元素时,我没有看到它的样式。这个问题只发生在某些元素上。
未获得所选元素的样式 这是我的代码, const model = 编辑器。StyleManager.getModelToStyle(component); let styleObject = model.getStyle(); console.log(“样式”,styleObj...
问题 #5090
组件脚本函数在保存页面后运行两次
GrapesJS 版本 [X] 我确认使用最新版本 GrapesJS 你用的是什么浏览器? 112.0.5615.137(官方配置)(arm64) 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 组件定义: 丢弃、保存和重新加载时...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
Introducing Search on GJS.Market
GJS.Market now has one search across everything we publish — plugins, articles, community questions, guides, authors and services. Press ⌘K from any page.
教程
GJS.Market Is Now Available for India 🇮🇳
GJS.Market is expanding its global presence with a dedicated experience for developers, agencies, SaaS companies, and digital creators in India
教程
如何在2026年用 GrapesJS 构建AI驱动的页面构建器
我们构建GJSDocs的经验——从简单的AI文本生成到结构化、上下文感知的视觉编辑
浏览插件分类
直接跳转到市场上的插件分类页面。