安装插件
`npm install leaflet-easyprint`
引入插件
import EasyPrint from 'leaflet-easyprint';
export default { $L,EasyPrint
};
对应页面使用
var tiles = await this.$utils.map.$L.tileLayer("http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=key", { noWrap: true }).addTo(this.map);
this.$utils.map.$L.easyPrint({
tileLayer: tiles,
sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
filename: 'myMap',
exportOnly: true,
hideControlContainer: true
}).addTo(this.map);