UNPKG

@dfsj/echarts

Version:

专业的水文曲线组件或构造函数以及通用的echart二次封装图表

38 lines (35 loc) 996 B
/** * * @dfsj/echarts: 专业的水文曲线组件或构造函数以及通用的echart二次封装图表 * 版本: v3.7.0-alpha.4 * 作者:yangbo <1747837358@qq.com> * 日期:2025-07-10 10:24:30 * * */ var defOptions = { name: '图表图片', suffix: '.png', pixelRatio: 2, backgroundColor: '#fff' }; function useDownLoad(getFn) { var downloadImg = function downloadImg(options) { var def = Object.assign({}, defOptions, options); var chartIns = typeof getFn == 'function' ? getFn() : getFn; var imgUrl = chartIns === null || chartIns === void 0 ? void 0 : chartIns.getDataURL({ pixelRatio: def.pixelRatio, backgroundColor: def.backgroundColor }); var tempA = document.createElement('a'); tempA.download = def.name + def.suffix; tempA.href = imgUrl; document.body.appendChild(tempA); tempA.click(); tempA.remove(); }; return { downloadImg: downloadImg }; } export { useDownLoad };