| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- class ResizeChart {
- /**
- * 监听resize
- */
- on (chart) {
- if (chart) {
- window.addEventListener('resize', function () {
- if (Array.isArray(chart) && chart.length) {
- for (let k = 0; k < chart.length; k++) {
- const el = chart[k]
- el.resize()
- }
- } else {
- if (chart instanceof Object) {
- chart.resize()
- } else {
- return false
- }
- }
- })
- }
- }
- /**
- * 关闭
- */
- off (chart) {
- if (chart) {
- window.removeEventListener('resize', function () {
- if (Array.isArray(chart) && chart.length) {
- for (let k = 0; k < chart.length; k++) {
- const el = chart[k]
- el.dispose()
- }
- } else {
- chart.dispose()
- }
- })
- }
- }
- }
- export default new ResizeChart()
|