问题描述
类型'Vue |中不存在属性'clientWidth'元素| Vue [] | Element []'。
属性'clientHeight'在类型'Vue |中不存在。元素| Vue [] | Element []'。
<div class="invoice-step-detail" id="invoice" ref="invoice">
@Component({
name: 'CreateInvoice',components: { }
})
export default class CreateInvoice extends Vue {
downloadPdf(){
let pdf = new jsPDF("p","pt","a4",true);
let invoice = document.getElementById('invoice');
let width = this.$refs.invoice.clientWidth;
let height = this.$refs.invoice.clientHeight;
html2canvas(invoice!).then(canvas => {
let image = canvas.toDataURL('image/png');
pdf.addImage(image,'PNG',width * 0.55,height * 0.55);
pdf.save('invoice');
})
}
async submitInvoice(): Promise<void> {
this.invoice = {
createdOn: new Date,updatedOn: new Date,customerId: this.selectedCustomerId,lineItems: this.lineItems,};
await invoiceService.makeNewInvoice(this.invoice);
this.downloadPdf();
await this.$router.push("/orders");
}
}
有什么建议吗?我仍然是新手,很奇怪的是,此代码以这种方式工作,但引发了该错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)