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

常熟网站开发百度推广费用

常熟网站开发,百度推广费用,江西住房和城乡建设厅网站首页,wordpress搜索框中的汉字怎么改概述 在做项目的时候会遇到docx、xlsx、pdf等文件的在线预览需求,实现此需求可以有多种解决方式,本文基于vue-office实现纯前端的文件预览。 效果 如下图,分别为docx、xlsx、pdf三种类型的文件在线加载后的效果。你也可以访问官方预览网址…

概述

在做项目的时候会遇到docxxlsxpdf等文件的在线预览需求,实现此需求可以有多种解决方式,本文基于vue-office实现纯前端的文件预览。

效果

如下图,分别为docxxlsxpdf三种类型的文件在线加载后的效果。你也可以访问官方预览网址查看效果。
image.png

实现

1. 添加依赖

package.json文件中添加如下依赖,并通过命令npm i安装依赖。

{...,"dependencies": {"@vue-office/docx": "1.6.0","@vue-office/excel": "1.6.0","@vue-office/pdf": "1.6.0"},
}

2. 引入依赖

vue文件中引入依赖,示例代码如下:

//引入相关样式
import '@vue-office/docx/lib/index.css'
import '@vue-office/excel/lib/index.css'//引入VueOffice组件
import VueOfficeDocx from '@vue-office/docx'
import VueOfficeExcel from '@vue-office/excel'
import VueOfficePdf from '@vue-office/pdf'export default {components: {VueOfficeDocx,VueOfficeExcel,VueOfficePdf},
}

3. 使用组件

<template><div class="layout-file"><div class="layout-file-title">{{docx}}</div><vue-office-docx :src="docx" @rendered="rendered"/></div><div class="layout-file"><div class="layout-file-title">{{excel}}</div><vue-office-excel :src="excel" @rendered="rendered"/></div><div class="layout-file"><div class="layout-file-title">{{pdf}}</div><vue-office-pdf style="height: 100%;" :src="pdf" @rendered="rendered"/></div>
</template>

完整的实现代码如下:

<template><div class="layout-file"><div class="layout-file-title">{{docx}}</div><vue-office-docx :src="docx" @rendered="rendered"/></div><div class="layout-file"><div class="layout-file-title">{{excel}}</div><vue-office-excel :src="excel" @rendered="rendered"/></div><div class="layout-file"><div class="layout-file-title">{{pdf}}</div><vue-office-pdf style="height: 100%;" :src="pdf" @rendered="rendered"/></div>
</template><script>
//引入相关样式
import '@vue-office/docx/lib/index.css'
import '@vue-office/excel/lib/index.css'//引入VueOffice组件
import VueOfficeDocx from '@vue-office/docx'
import VueOfficeExcel from '@vue-office/excel'
import VueOfficePdf from '@vue-office/pdf'export default {components: {VueOfficeDocx,VueOfficeExcel,VueOfficePdf},data() {return {pdf: 'http://localhost:18081/doc.pdf',excel: 'http://localhost:18081/doc.xlsx',docx: 'http://localhost:18081/doc.docx',ppt: 'http://localhost:18081/doc.pptx'}},methods: {rendered() {console.log('rendered')}}
}
</script><style lang="scss" scoped>
.layout-file {width: calc(50% - 1rem);height: 50%;float: left;margin-top: 0.8rem;margin-right: 0.8rem;position: relative;border: 1px solid #f00;border-radius: 0.3rem;&:nth-child(1), &:nth-child(2) {margin-top: 0;}.layout-file-title {position: absolute;top: 0.5rem;right: 1.5rem;background-color: rgba(255,0,0,0.8);padding: 0.1rem 0.4rem;z-index: 99;color: #fff;border-radius: 0.3rem;font-size: 12px;}
}
</style>
http://www.hkea.cn/news/473369/

相关文章:

  • 房地产网站建设方案百度实名认证
  • 做外贸可以在哪些网站注册网络项目免费的资源网
  • 中国建设银行信用卡网站首页青岛关键词优化平台
  • 阿里云网站建设考试题目长沙网站推广服务公司
  • 甘肃建设项目审批权限网站俄罗斯搜索引擎yandex官网入口
  • 网站建设公司新员工培训ppt模板百度热门搜索排行榜
  • 仿魔客吧网站模板网址大全是ie浏览器吗
  • 网站产品后台界面怎么做湖南关键词排名推广
  • 网站数据每隔几秒切换怎么做的湖南百度seo排名点击软件
  • 网站制作先学什么百度新闻下载安装
  • 河南省网站建设哪家好免费观看行情软件网站进入
  • 粘合剂东莞网站建设体育热点新闻
  • 百度网站排名关键词整站优化培训网站建设
  • 网络平台代理seo外包 杭州
  • 东方头条网站源码免费推广软件工具
  • 北京网站建设公司分享网站改版注意事项流程优化四个方法
  • 案例学 网页设计与网站建设手机百度seo快速排名
  • 江门网站建设总部电话产品推广渠道有哪些
  • 网站建设全攻略站长之家ping检测
  • 导航网站 cmsgoogle chrome谷歌浏览器
  • wordpress看其他人博客优化师是做什么的
  • 现在哪个网站还做白拿2021小说排行榜百度风云榜
  • 网站流量seo提升seo排名的方法
  • 做html网站模板下载地址网站页面布局和样式设计
  • 公司网站邮箱费用磁力宅在线搜种子
  • wordpress 缺少临时文件夹刷关键词优化排名
  • 做网站要有什么团队淘宝关键词排名查询工具
  • 开源门户网站源码宁波谷歌seo
  • wordpress+一页一屏seo关键技术有哪些
  • 学校校园网站建设实施方案精准营销的案例