Vue2-golden-layout 如何实现复杂布局设计?

更新于
2026-09-29 11:09:13
10阅读来源:SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计308个文字,预计阅读时间需要2分钟。

Vue2-golden-layout 如何实现复杂布局设计?

使用配置方法:javascriptimport 'golden-layout/src/css/goldenlayout-base.css';import 'golden-layout/src/css/goldenlayout-dark-theme.css';import 'golden-layout/lib/jquery';

官方示例中,主要功能基本都需要通过注册组件的方法来实现。

使用配置:

import 'golden-layout/src/css/goldenlayout-base.css'
import 'golden-layout/src/css/goldenlayout-dark-theme.css'
import 'golden-layout/lib/jquery'

官方示例中,主要功能基本都需要写注册组件的方法才能实施,而且配置布局每一个都不一样,需要配置想要的初始布局,及布局的组件名。并且注册组件的方法需要组件名,及指定组件内容,最后初始化组件,就可开始拖拽布局页面了。

配置布局:
var config = {
content: [{
type: 'row',
content: [{
type:'component',
componentName: 'example',
componentState: { text: 'Component 1' }
},
{
type:'component',
componentName: 'example',
componentState: { text: 'Component 2' }
}]
}]
};
实例化GoldenLayout
var myLayout = new window.GoldenLayout( config, $('#layoutContainer') );
注册组件及添加指定内容
myLayout.registerComponent( 'example', function( container, state ){
container.getElement().html( '<h2>' + state.text + '</h2>');
});
初始化布局
myLayout.init()




Vue2-golden-layout 如何实现复杂布局设计?

本文共计308个文字,预计阅读时间需要2分钟。

Vue2-golden-layout 如何实现复杂布局设计?

使用配置方法:javascriptimport 'golden-layout/src/css/goldenlayout-base.css';import 'golden-layout/src/css/goldenlayout-dark-theme.css';import 'golden-layout/lib/jquery';

官方示例中,主要功能基本都需要通过注册组件的方法来实现。

使用配置:

import 'golden-layout/src/css/goldenlayout-base.css'
import 'golden-layout/src/css/goldenlayout-dark-theme.css'
import 'golden-layout/lib/jquery'

官方示例中,主要功能基本都需要写注册组件的方法才能实施,而且配置布局每一个都不一样,需要配置想要的初始布局,及布局的组件名。并且注册组件的方法需要组件名,及指定组件内容,最后初始化组件,就可开始拖拽布局页面了。

配置布局:
var config = {
content: [{
type: 'row',
content: [{
type:'component',
componentName: 'example',
componentState: { text: 'Component 1' }
},
{
type:'component',
componentName: 'example',
componentState: { text: 'Component 2' }
}]
}]
};
实例化GoldenLayout
var myLayout = new window.GoldenLayout( config, $('#layoutContainer') );
注册组件及添加指定内容
myLayout.registerComponent( 'example', function( container, state ){
container.getElement().html( '<h2>' + state.text + '</h2>');
});
初始化布局
myLayout.init()




Vue2-golden-layout 如何实现复杂布局设计?