首页 > 解决方案 > 如何从参数键中提取值

问题描述

我知道可以从配置器的 iFrame 外部读取参数

const frameColour = params.find(({ key }) => key === "frameColour");

但是否可以在 ADD TO CART 操作中读取参数键 (frameColour) 的值并将其显示在 HTML DIV / Input 中?原因是我有参数键,即我正在构建的货架框架的颜色,我希望能够读取颜色并将其显示到屏幕上,然后我可以将该颜色存储在我的外部数据库中

标签: roomle

解决方案


After you've created a new configurator using the embedding API you can use this to get notified about parameter updates:

configurator.extended.callbacks.onUpdateParameters = (parameters) => {
        // add your logic here
    };

configurator.extended will give you access to the RoomleConfigurator instance (https://docs.roomle.com/web/api/classes/roomleconfigurator.html)


推荐阅读