javascript - 如何将动态参数传递给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%" }}
/>);
}
解决方案
推荐阅读
- ios - Firebase User Auth check in App delegate
- java - Change DB column type on the fly
- javascript - 在formpree中使用uploadcare而不使用小部件
- ios - CollectionView 单元格移出框架
- javascript - "npm start" throws Error: Plugin/Preset files are not allowed to export objects, only functions
- php - Laravel 和 Nova 中的“在 null 上调用没有 globalScopes 的成员函数”
- python - How to extract only a specific part of url in Python and add its value as another column in df for every row?
- angular - Angular:Redux 和延迟加载
- xml - 如何使用 xslt 将 xml 转换为字符串
- javascript - Reactjs - 我想使用一些 json-server 模拟数据来测试我的登录应用程序