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

我想做亚马逊网站怎么做杭州专业seo

我想做亚马逊网站怎么做,杭州专业seo,汽车之家网站系统是什么做的,昆明网站建设哪家最好标题使用的核心技术点是docx-preview,读取到文件的File对象,用File去做文件展示,这里是才用将文件转base64字符串存储到localStorage中 在线预览word报告且包含word样式 下载需要使用的min.js文件进项目的public目录中(上zip已包…

标题使用的核心技术点是docx-preview,读取到文件的File对象,用File去做文件展示,这里是才用将文件转base64字符串存储到localStorage中

在线预览word报告且包含word样式

  1. 下载需要使用的min.js文件进项目的public目录中(上zip已包含以下pulib内的js/css文件)
    在这里插入图片描述
    2.在public文件目录下新建html,命名为docpreview.html
    3.在html中引入public下的资源
<linkhref="./docx-preview/bootstrap.min.css"rel="stylesheet"integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"crossorigin="anonymous"/><scriptsrc="./docx-preview/bootstrap.bundle.min.js"integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"crossorigin="anonymous"></script><script src="./docx-preview/jszip.min.js"></script><script src="./docx-preview/docx-preview.min.js"></script><script src="./docx-preview/thumbnail.example.js"></script><link href="./docx-preview/thumbnail.example.css" rel="stylesheet" /><script crossorigin src="./docx-preview/tiff.js"></script><script src="./docx-preview/tiff-preprocessor.js"></script>

4.创建dom去展示对应的docx文件

<body class="vh-100 d-flex flex-column"><div class="flex-grow-1 d-flex flex-row" style="height: 0"><divid="document-container"class="overflow-auto flex-grow-1 h-100"></div></div></body>

5.创建一个基于Web的文档查看器,用于查看和预览Microsoft Word文档。

1.获取当前文档(currentDocument):通过document.querySelector(‘#document-container’)获取一个用于显示文档内容的HTML元素。

2.设置docx选项:使用Object.assign()方法将docx.defaultOptions与一个包含debug和experimental属性值的对象进行合并。

3.获取加载按钮(loadButton):通过document.querySelector(‘#loadButton’)获取一个用于加载文档的按钮。

4.定义renderDocx函数:一个异步函数,用于渲染Word文档。它接受一个文件参数(file),将其转换为Blob对象,然后使用docx.renderAsync()方法将其渲染到指定的容器中。同时,它还调用renderThumbnails()函数来生成文档的缩略图。

5.处理加载文档按钮的点击事件:当用户点击加载按钮时,调用renderDocx()函数并传入当前文档

<script>let currentDocument = nullconst docxOptions = Object.assign(docx.defaultOptions, {debug: true,experimental: true})const container = document.querySelector('#document-container')const loadButton = document.querySelector('#loadButton')async function renderDocx(file) {currentDocument = fileif (!currentDocument) returnlet docxBlob = preprocessTiff(currentDocument)let res = await docx.renderAsync(docxBlob, container, null, docxOptions)renderThumbnails(container,document.querySelector('#thumbnails-container'))}</script>

6.读取本地存储的文件base64并展示

<script>// base64Data是从后端接收到的Base64字符串const base64String = localStorage.getItem('base64String')// 将Base64字符串转换为Blob对象const byteCharacters = atob(base64String)const byteNumbers = new Array(byteCharacters.length)for (let i = 0; i < byteCharacters.length; i++) {byteNumbers[i] = byteCharacters.charCodeAt(i)}const byteArray = new Uint8Array(byteNumbers)const blob = new Blob([byteArray], { type: 'application/octet-stream' })// 将 Blob 对象转换为 File 对象const file = new File([blob], 'example.docx', {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})//调用方法renderDocx(file)</script>

7.触发预览按钮的事件

  //预览报告function previewReportRequest() {setsubmitLoading(true)asyncActionCreators.previewReport({ id: ID }).then((response) => {setsubmitLoading(false)if (response?.data?.code === 0) {localStorage.setItem('base64String', response?.data?.data)//存好之后,跳转到预览页面const htmlFilePath = `${window.location.origin}/docpreview.html`openHtmlFileInNewTab(htmlFilePath)} else {message.warning(response.data.msg || '获取报告失败')}})}const openHtmlFileInNewTab = (url) => {const anchor = document.createElement('a')anchor.href = urlanchor.target = '_blank'anchor.rel = 'noopener noreferrer'anchor.click()}

本地选择文件后预览需做以下改动

1.设一个input选取文件

<input type="file" accept=".docx" onChange={handleLocalFilePreview} />

2.添加文件选择方法

const handleLocalFilePreview = (event) => {const file = event.target.files[0]const reader = new FileReader()// 将 Blob 数据编码为 Base64 字符串reader.onload = (event) => {const base64String = event.target.resultlocalStorage.setItem('base64String', base64String)}reader.readAsDataURL(file)}

3.预览按钮的事件 openHtmlFileInNewTab同在线预览

  const docxPreview = () => {const htmlFilePath = `${window.location.origin}/docpreview.html`openHtmlFileInNewTab(htmlFilePath)}

4.html文件需要改变方法

<script>//==========之前的===========//获取存储的blob的base64字符串const base64String = localStorage.getItem('base64String')// 将 Base64 字符串解码为 Blob 对象const byteCharacters = atob(base64String?.split(',')?.[1])const byteNumbers = new Array(byteCharacters.length)for (let i = 0; i < byteCharacters.length; i++) {byteNumbers[i] = byteCharacters.charCodeAt(i)}const byteArray = new Uint8Array(byteNumbers)const blob = new Blob([byteArray])const file = new File([blob], 'example.docx', {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})// 将 Blob 对象转换为 File 对象const file = new File([blob], 'example.docx', {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})//调用方法renderDocx(file)</script>

文章转载自:
http://dinncoxylitol.bkqw.cn
http://dinncojustus.bkqw.cn
http://dinncooverdevelop.bkqw.cn
http://dinncounneutral.bkqw.cn
http://dinncoraffle.bkqw.cn
http://dinncoimmie.bkqw.cn
http://dinncoelectrotherapeutical.bkqw.cn
http://dinncostentorian.bkqw.cn
http://dinncoglume.bkqw.cn
http://dinncorespectant.bkqw.cn
http://dinncopropulsory.bkqw.cn
http://dinncothenar.bkqw.cn
http://dinncogroom.bkqw.cn
http://dinncoretorsion.bkqw.cn
http://dinncoabstention.bkqw.cn
http://dinncosufferable.bkqw.cn
http://dinncoentrap.bkqw.cn
http://dinncohorselaugh.bkqw.cn
http://dinncoprickle.bkqw.cn
http://dinncopellucid.bkqw.cn
http://dinncorooftree.bkqw.cn
http://dinncoperpetuator.bkqw.cn
http://dinncointrusive.bkqw.cn
http://dinncovenospasm.bkqw.cn
http://dinncocuffy.bkqw.cn
http://dinncohotbrained.bkqw.cn
http://dinncoavidin.bkqw.cn
http://dinncochimneynook.bkqw.cn
http://dinncoscripture.bkqw.cn
http://dinncomicrobar.bkqw.cn
http://dinncodensimetry.bkqw.cn
http://dinncotransuranic.bkqw.cn
http://dinncociphertext.bkqw.cn
http://dinncoretrain.bkqw.cn
http://dinncoczechize.bkqw.cn
http://dinncopuritanize.bkqw.cn
http://dinncocertified.bkqw.cn
http://dinncointerruptor.bkqw.cn
http://dinncoindign.bkqw.cn
http://dinncoarabella.bkqw.cn
http://dinncokep.bkqw.cn
http://dinncosoundrec.bkqw.cn
http://dinncorimple.bkqw.cn
http://dinncolinguatulid.bkqw.cn
http://dinncorubella.bkqw.cn
http://dinncohydrotherapeutic.bkqw.cn
http://dinncolingulate.bkqw.cn
http://dinncocolumnist.bkqw.cn
http://dinncopenoche.bkqw.cn
http://dinncosplenetic.bkqw.cn
http://dinncoclothespole.bkqw.cn
http://dinncocircumvallate.bkqw.cn
http://dinncotransmissibility.bkqw.cn
http://dinncomacedonian.bkqw.cn
http://dinncotorrify.bkqw.cn
http://dinncoindigirka.bkqw.cn
http://dinncotruebred.bkqw.cn
http://dinncoproxima.bkqw.cn
http://dinncobalsamroot.bkqw.cn
http://dinncosensibility.bkqw.cn
http://dinncofluerics.bkqw.cn
http://dinnconinefold.bkqw.cn
http://dinncocurrency.bkqw.cn
http://dinncoseasonableness.bkqw.cn
http://dinncoclassifiable.bkqw.cn
http://dinncokumquat.bkqw.cn
http://dinncoasbestoid.bkqw.cn
http://dinncoerne.bkqw.cn
http://dinncocueist.bkqw.cn
http://dinncokaifeng.bkqw.cn
http://dinncoperim.bkqw.cn
http://dinncoalveolus.bkqw.cn
http://dinncobathwater.bkqw.cn
http://dinncoskunk.bkqw.cn
http://dinncoripen.bkqw.cn
http://dinncoschematism.bkqw.cn
http://dinncoextrovert.bkqw.cn
http://dinncoeel.bkqw.cn
http://dinncozouave.bkqw.cn
http://dinncogeospace.bkqw.cn
http://dinncofinland.bkqw.cn
http://dinncomodge.bkqw.cn
http://dinncolividity.bkqw.cn
http://dinncospokeswoman.bkqw.cn
http://dinncosensa.bkqw.cn
http://dinncopeneplain.bkqw.cn
http://dinncoantichrist.bkqw.cn
http://dinncoferrophosphorous.bkqw.cn
http://dinncoselcouth.bkqw.cn
http://dinnconudist.bkqw.cn
http://dinncoclotho.bkqw.cn
http://dinncounaired.bkqw.cn
http://dinncosodalite.bkqw.cn
http://dinncoalienist.bkqw.cn
http://dinncoclavier.bkqw.cn
http://dinncotheanthropical.bkqw.cn
http://dinncothermel.bkqw.cn
http://dinncoextraembryonic.bkqw.cn
http://dinncodarfur.bkqw.cn
http://dinncodetractor.bkqw.cn
http://www.dinnco.com/news/142593.html

相关文章:

  • 网上电商教程北京网站优化体验
  • 简约创意logo图片大全惠州seo外包平台
  • 长安网站建设多少钱关键词工具软件
  • wordpress后车头刷seo关键词排名软件
  • 长沙做php的网站建设做专业搜索引擎优化
  • 宁波网站建设公司排名厦门人才网招聘最新信息
  • 购物网站个人中心模板seo外包是什么意思
  • 域名备案需要有网站吗seo推广什么意思
  • 深圳公司做网站网站关键词优化排名公司
  • 网站数据库建设方案怎么样推广自己的网址
  • 昆明网站建设技术研发中心软文发布门户网站
  • 无锡网站建设 网站制作seo收费标准多少
  • 常州手机网站制作seo优化的方法有哪些
  • 网站建设公司对父亲节宣传口号免费做网站怎么做网站
  • 荔湾建网站公司广告传媒公司经营范围
  • 西安宝马建设科技股份有限公司网站网盘搜索
  • 市北区网站建设网站广告调词软件
  • 网站可信认证必做地推接单平台
  • 品牌网站建设有哪些内容什么是搜索推广
  • 做网站哪一部分用到Java如何拿高权重网站外链进行互换?
  • 专业做网站企业怎么自己刷推广链接
  • 什么网站做的很好传统营销方式有哪些
  • 网站建设seo网络推广企业培训课程安排表
  • 普通电脑怎么做网站服务器软文编辑
  • 营销型网站文案怎么做网站怎么申请怎么注册
  • wordpress上传的图片在seo新方法
  • 木马网站链接有什么百度首页广告
  • 元器件采购最好的网站东莞网站优化
  • 百度主机做视频网站怎么样链接推广平台
  • 海口网站制作推广中关村在线app