|
| 1 | +/* eslint-disable */ |
| 2 | +import * as VTable from '../../src'; |
| 3 | +import VChart from '@visactor/vchart'; |
| 4 | +import { bindDebugTool } from '../../src/scenegraph/debug-tool'; |
| 5 | + |
| 6 | +const CONTAINER_ID = 'vTable'; |
| 7 | +VTable.register.chartModule('vchart', VChart); |
| 8 | +export function createTable() { |
| 9 | + const option = { |
| 10 | + columns: [ |
| 11 | + { field: 'id', title: 'ID', width: 80 }, |
| 12 | + { field: 'name', title: '姓名', width: 120 }, |
| 13 | + { field: 'age', title: '年龄', width: 80 }, |
| 14 | + { field: 'city', title: '城市', width: 120 } |
| 15 | + ], |
| 16 | + records: Array.from({ length: 10000 }, (_, i) => ({ |
| 17 | + id: i, |
| 18 | + name: `张三${i}`, |
| 19 | + age: i, |
| 20 | + city: `城市${i}` |
| 21 | + })) |
| 22 | + }; |
| 23 | + // document.getElementById(CONTAINER_ID).parentElement.style.display = 'none'; |
| 24 | + let tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); |
| 25 | + // window.tableInstance = instance; |
| 26 | + |
| 27 | + // tableInstance.onVChartEvent('mouseover', args => { |
| 28 | + // console.log('listenChart mouseover', args); |
| 29 | + // }); |
| 30 | + |
| 31 | + // bindDebugTool(tableInstance.scenegraph.stage, { |
| 32 | + // customGrapicKeys: ['col', 'row'] |
| 33 | + // }); |
| 34 | + |
| 35 | + const update = async () => { |
| 36 | + // 执行20次release / new |
| 37 | + for (let i = 0; i < 20; i++) { |
| 38 | + await new Promise(resolve => setTimeout(resolve, 200)); |
| 39 | + // // tableInstance.release(); |
| 40 | + // // instance.scenegraph.component.vScrollBar.release(); |
| 41 | + // // instance.scenegraph.component.hScrollBar.release(); |
| 42 | + // // instance.scenegraph.stage.removeAllChild(); |
| 43 | + // // delete instance.scenegraph.stage.table; |
| 44 | + // // instance.scenegraph.clearCells(); |
| 45 | + // tableInstance.scenegraph.component.vScrollBar.release(); |
| 46 | + // tableInstance.scenegraph.component.hScrollBar.release(); |
| 47 | + // tableInstance.animationManager.clear(); |
| 48 | + // tableInstance.animationManager.ticker.release(); |
| 49 | + // // instance.animationManager.ticker = null; |
| 50 | + // // instance.animationManager = null; |
| 51 | + // tableInstance.scenegraph.stage.ticker.release(); |
| 52 | + tableInstance.release(); |
| 53 | + tableInstance = null; |
| 54 | + await new Promise(resolve => setTimeout(resolve, 200)); |
| 55 | + tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID), option); |
| 56 | + console.log(`第${i}次new完成`); |
| 57 | + } |
| 58 | + }; |
| 59 | + |
| 60 | + window.update = update; |
| 61 | + // update(); |
| 62 | +} |
0 commit comments