<template>
<div>
<img :src="imgSrc" alt="">
</div>
</template>
<script>
export default {
data() {
return {
imgSrc: ''
}
},
created() {
this.imgSrc = localStorage.getItem('printImage');
},
mounted() {
this.print()
},
beforeDestroy() {
localStorage.removeItem('printImage');
},
methods: {
print() {
this.$nextTick(function() {
if (this.imgSrc) {
window.print();
}
})
}
}
}
</script
03-15
1373
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-12
5263
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-17
730
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)