首页 > 解决方案 > 如何将动态参数传递给react-froala中的自动保存?

问题描述

在froala-edit组件中,autosave参数只能在第一次创建时获取props参数,而在props更新时autosave参数是不会更新的。

你有什么好的解决办法吗?

谢谢

export default function MyEdit(props) {

  const config = {
    quickInsertEnabled: false,
    tabSpaces: 4,
    language: 'zh_cn',
    saveInterval: 6000 * 10, 
    saveMethod: 'POST',
    saveURL: 'https://localhost:44343/FileNote',
    saveParams: {
      id: props.fileId,      // Expect this parameter to be updated when the props of the component are updated
      name: props.name
    },
    saveParam: 'content', 
  }
 return (
    <Editor
      config={config}
      style={{ height: "100%" }}
    />);
}

标签: javascriptreactjsfrontendfroala

解决方案


推荐阅读