gba*_*rry 6 typescript golden-layout angular6
我收到错误GoldenLayoutModule.forRoot(config)
config 不可分配给 type 的参数
GoldenLayoutConfiguration。
import { AppComponent } from './app.component';
import { GoldenLayoutModule, GoldenLayoutConfiguration } from '@embedded-enterprises/ng6-golden-layout';
import * as $ from 'jquery';
// It is required to have JQuery as global in the window object.
window['$'] = $;
// const config: GoldenLayoutConfiguration { /* TODO */ };
let config = {
content: [{
type: 'row',
content:[{
type: 'component',
componentName: 'testComponent',
componentState: { label: 'A' }
},{
type: 'column',
content:[{
type: 'component',
componentName: 'testComponent',
componentState: { label: 'B' }
},{
type: 'component',
componentName: 'testComponent',
componentState: { label: 'C' }
}]
}]
}]
};
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
GoldenLayoutModule.forRoot(config)
],
entryComponents: [
// TODO Add your components which are used as panels in golden-layout also here.
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
config需要是 类型GoldenLayoutConfiguration。看起来像这条线
let config = {
Run Code Online (Sandbox Code Playgroud)
是你的问题。尝试这个:
let config:GoldenLayoutConfiguration = {
Run Code Online (Sandbox Code Playgroud)
文档是这样说的:
myLayout = new GoldenLayout({
content:[{
type: 'component',
componentName: 'sayHi',
componentState: { name: 'Wolfram' }
}]
});
Run Code Online (Sandbox Code Playgroud)
所以这是你可以尝试的其他事情。