Golden Layout 2.6版本状态保存失败问题求助
Angular中使用Golden Layout 2.6版本状态保存加载报错问题
我在Angular项目里使用Golden Layout 2.6版本时,套用了官方文档中针对1.5.9以下版本的状态保存与加载代码:
myLayout.on( 'stateChanged', function(){ var state = JSON.stringify( myLayout.toConfig() ); localStorage.setItem( 'savedState', state ); }); var myLayout, savedState = localStorage.getItem( 'savedState' ); if( savedState !== null ) { myLayout = new GoldenLayout( JSON.parse( savedState ) ); } else { myLayout = new GoldenLayout( config ); }
运行后出现以下错误:
app.routes.ts:9 ERROR TypeError: value.trimStart is not a function at splitStringAtFirstNonNumericChar (utils.js:12:17) at parseSize (config.js:856:7) at Object.resolveSize (config.js:62:14) at Object.resolve (config.js:232:20) at Object.resolve (config.js:19:32) at Object.resolve (config.js:542:33) at Object.resolve (config.js:716:30) at GoldenLayout.init (layout-manager.js:251:42) at GoldenLayout.init (virtual-layout.js:92:11) at _LayoutComponent.ngAfterViewInit (layout.component.ts:53:23)
我找不到可行的解决办法,怀疑是Golden Layout项目维护不到位导致的问题。另外我注意到React的flex layout在状态保存这块表现正常,有可复现该错误的最小代码示例。
内容的提问来源于stack exchange,提问作者Victor Martinez
相关产品推荐
相关产品推荐

