Files
mes-ui-d2/src/pages/demo/chart/index2/mixins/layout.js
李杨 f1d7e49da3 no message
Former-commit-id: c1f283658a2670885fe8217fd2c32385034468ab
Former-commit-id: 5f39ffd696f1c4a541d976b2593ea2ec5810aa21
Former-commit-id: f08a3e0712d277baad4924fbf7bbda255bbaa5f8
2018-02-17 10:32:51 +08:00

45 lines
1.1 KiB
JavaScript

export default {
data () {
return {
layout: {
// 调整布局时 复制 layoutUpdatedHandler() 输出的日志到这里
layout: [
{'x': 0, 'y': 0, 'w': 8, 'h': 9, 'i': '0'},
{'x': 8, 'y': 0, 'w': 4, 'h': 9, 'i': '1'},
{'x': 0, 'y': 9, 'w': 4, 'h': 7, 'i': '2'}
],
colNum: 12,
rowHeight: 30,
isDraggable: true,
isResizable: true,
isMirrored: false,
verticalCompact: true,
margin: [10, 10],
useCssTransforms: true
}
}
},
methods: {
// 更新指定的图表
chartResize () {
this.$log('chartResize')
},
// 布局组件发生变化
layoutUpdatedHandler (newLayout) {
console.group('layoutUpdatedHandler')
newLayout.forEach(e => {
console.log(`{'x': ${e.x}, 'y': ${e.y}, 'w': ${e.w}, 'h': ${e.h}, 'i': '${e.i}'},`)
})
console.groupEnd()
},
// 改变尺寸
resizeHandler (name) {
this.chartResize()
},
// 改变尺寸完成
resizedHandler (name) {
this.chartResize()
}
}
}