当前位置: 首页 > news >正文

免费wap网站制作网站排名优化系统

免费wap网站制作,网站排名优化系统,客户做网站一定报价怎么办,wordpress局域网404纯前端上传word,xlsx,ppt,在前端预览并下载成图片(预览效果可以,下载图片效果不太理想) 一.安装依赖二、主要代码 预览效果链接: https://github.com/501351981/vue-office 插件文档链接: https://501351981.github.io/vue-office/examples/d…

纯前端上传word,xlsx,ppt,在前端预览并下载成图片(预览效果可以,下载图片效果不太理想)

  • 一.安装依赖
  • 二、主要代码

预览效果链接: https://github.com/501351981/vue-office
插件文档链接: https://501351981.github.io/vue-office/examples/docs/config/

一.安装依赖

//docx文档预览组件
npm install @vue-office/docx vue-demi//excel文档预览组件
npm install @vue-office/excel vue-demi//pdf文档预览组件
npm install @vue-office/pdf vue-demi
//html生成图片
npm install html2canvas

二、主要代码

<template><div class="index"><div class="select-file"><input id="input" type="file" /></div><div class="file-preview" ref="excelContainer"><!-- <VueOfficeDocx v-if="src" style="height: 600px;" :src="src" /> --><VueOfficeExcel class="file-content" v-if="src" style="height: 1280px" :src="src" /><!-- <VueOfficePdf v-if="src" style="height: 600px" :src="src" /> --></div><button @click="generateImage">Generate Image</button></div>
</template>
<script>
// import VueOfficeDocx from '@vue-office/docx'
// import '@vue-office/docx/lib/index.css'import VueOfficeExcel from '@vue-office/excel'
import '@vue-office/excel/lib/index.css'// import VueOfficePdf from '@vue-office/pdf'import html2canvas from 'html2canvas'
export default {data() {return {src: '',}},components: {// VueOfficeDocx,VueOfficeExcel,//  VueOfficePdf},mounted() {this.addInputEventListener()},methods: {/*** application/msword;charset=utf-8* application/pdf;charset=utf-8* application/vnd.ms-excel*/addInputEventListener() {const input = document.querySelector('#input')input.addEventListener('input', e => {const fileBlob = e.target.files[0]// 第一种方式(通过window.URL.createObjectURL将Blob文件流转为一个路径)this.src = window.URL.createObjectURL(new Blob([fileBlob]))// 第二种方式(转为base64编码)const fileReader = new FileReader()fileReader.readAsDataURL(fileBlob)fileReader.onload = e => {this.src = e.target.result}// 第三种方式(获取到buffer)fileBlob.arrayBuffer().then(buffer => {this.src = buffer})})},generateImage() {const element = this.$refs.excelContainerhtml2canvas(element, { useCORS: true }).then(canvas => {const image = canvas.toDataURL('image/png')const link = document.createElement('a')link.href = imagelink.download = 'excel_image.png'link.click()}).catch(error => {console.error('Error generating image:', error)})},},
}
</script>
<style scoped>
.index {width: 100%;height: 100%;padding: 15px;box-sizing: border-box;
}
.select-file {width: 100%;height: 35px;border-bottom: 1px dashed #ccc;margin-bottom: 15px;
}
.file-preview {width: 100%;height: 100%;border: 1px dashed #007acc;
}
</style>

在这里插入图片描述

没了~

链接: https://www.jb51.net/article/278400.htm

http://www.hkea.cn/news/65977/

相关文章:

  • 太仓网站建设有限公司网站设计公司怎么样
  • 网站去哪做在线crm软件
  • 做360手机网站快速汕头seo排名收费
  • 网站建设总做总结宜兴百度推广公司
  • 做毕业网站的周记外贸建站优化
  • 南昌市住房和城乡建设局网站百度官网推广平台电话
  • 真人做视频网站百度怎么发布广告
  • 网站页面优化包括怎么给网站做优化
  • 哪个网站用帝国cms做的软文素材网
  • 网站建设需要的资料深圳精准网络营销推广
  • 客户网站建设公司网站排名提升软件
  • 网站建设与维护试卷论文怎么在百度上做广告
  • 做博客网站要什么技术百度网站网址是多少
  • 河北建设厅官方网站八大员考试站长工具查询
  • 大连 做网站公司爱站工具包的主要功能
  • ps做简洁大气网站必应bing国内版
  • 做公司标志用哪个网站营销自动化
  • wordpress5.0.3厦门百度seo
  • 网站开发 企业 定制系统优化大师安卓版
  • 网站内链符号seo百度站长工具
  • 网站页面太多是否做静态seo优化软件
  • mac下怎么安装wordpress关键词排名优化易下拉霸屏
  • 国内做国外代购在哪个网站好百度平台客服怎么联系
  • 菏泽网站获客网站建设公司中国站长网入口
  • 黄冈网站建设推荐seo查询排名软件
  • 自己怎么做百度网站广州seo网站公司
  • 京东企业的电子网站建设百度seo教程网
  • 弥勒网站设计公司share群组链接分享
  • 网站建设栏目管理百度推广搜索排名
  • 企业管理类的网站全球搜是什么公司