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

东莞网站设计定做东莞网站建设最牛

东莞网站设计定做,东莞网站建设最牛,网站建设要代码有什么好处,发布悬赏任务的推广平台作者#xff1a;fyupeng 技术专栏#xff1a;☞ https://github.com/fyupeng 项目地址#xff1a;☞ https://github.com/fyupeng/distributed-blog-system-api 留给读者 本文 一、介绍 对于PDF预览#xff0c;有很多开发者都遇到过头疼的难题#xff0c;今天给大家介绍… 作者fyupeng 技术专栏☞ https://github.com/fyupeng 项目地址☞ https://github.com/fyupeng/distributed-blog-system-api 留给读者 本文 一、介绍 对于PDF预览有很多开发者都遇到过头疼的难题今天给大家介绍一个比较成熟的浏览器直接提供的预览嵌入Vue组件。 二、代码 快速使用 html渲染 el-dialog:lock-scrollfalsecustom-classimgPreview_dia:show-closetruetop5vhwidth90vwv-modeldialogVisiblefilePreview :fileUrlfileUrl width90vw height90vh/filePreview/el-dialogcss样式 .imgPreview_dia {border-radius: 0 !important;margin: 0;left: 5vw; }js 处理 const dialogVisible ref(false);const fileUrl ref();const handleYulan (index: number, row: object) {fileUrl.value // showDocFile() http://localhost:8086/machine/commonFile/notice/showDocFile ?fileId row.fileId pripid props.initData?.pripid time new Date().getTime();// fileUrl.value // showDocFile() // ?docId2516gid4055fb556a9c440590464017f28aae0etime1691460960121;dialogVisible.value true; };模板 后端处理 public Boolean showNoticeDocFile(String fileId, HttpServletResponse response) {FileInputStream input null;OutputStream output null;try {File file getNoticeDocRowFile(fileId);if (file null || !file.exists()) {return false;}input new FileInputStream(file);int i input.available(); // 得到文件大小byte[] data new byte[i];input.read(data); // 读数据response.setContentType(application/pdf); // 设置返回的文件类型response.addHeader(Content-Length, String.valueOf(data.length)); //文件大小output response.getOutputStream(); // 得到向客户端输出二进制数据的对象output.write(data); // 输出数据output.flush();file.delete();return true;} catch (Exception e) {logger.error(showFile文件信息回显失败fileId:{}, fileId, e);return false;} finally {try {if (input ! null)input.close();if (output ! null)output.close();} catch (IOException e) {logger.error(e.getMessage(), e);}}}前端处理 filePreview.vue templatediv classwrap v-loadingisLoadingdiv classpdf-containeriframeiddoc-iframe:srcurl:style{ width: prop.width, height: prop.height, background: #fff }classparintDetailDocrefiframeRef/iframe/div/div /templatescript langts setup import { ref, reactive, watch, defineProps, defineEmits, onMounted } from vue; import { ElMessage } from element-plus; const emits defineEmits([loaded]); const prop defineProps({fileUrl: {type: String,default: ,},width: {type: String,default: 800px,},height: {type: String,default: 800px,}, }); const isLoading ref(true); const url ref();watch(() prop.fileUrl,() {url.value prop.fileUrl;console.log(--------prop.fileUrl, prop.fileUrl);},{ immediate: true } ); onMounted(() {let iframeDom document.getElementById(doc-iframe) || {};iframeDom.onload function () {isLoading.value false;emits(loaded);}; }); /scriptstyle scoped .parintDetailDoc::-webkit-scrollbar {display: none; } .parintDetailDoc {border: none;max-width: 100%; } /style 三、总结 简洁、高效、实用
http://www.w-s-a.com/news/608783/

相关文章:

  • 网站开发的软件天猫的网站导航怎么做的
  • 做链接哪个网站好网站建设平台方案设计
  • 资质升级业绩备案在哪个网站做网站建设方案费用预算
  • 做网站找哪个平台好wordpress 3.9 性能
  • 大兴模版网站建设公司企业网站备案案例
  • h5建站是什么wordpress客户端 接口
  • 济南自适应网站建设制作软件下载
  • 望都网站建设抖音广告投放收费标准
  • 网站制作软件排行榜上海市网站建设公司58
  • 什么是网站风格中国工商网企业查询官网
  • 专业建设专题网站wordpress lnmp wamp
  • 环保网站 下载页网站
  • 开源小程序模板江门关键词优化排名
  • 网站开发 知乎房地产型网站建设
  • 买完域名网站怎么设计wordpress 纯代码
  • 公司网站怎么做百度竞价宁波网络公司哪家好
  • 河西网站建设制作微信分销系统多层
  • 网站制作完成后应进入什么阶段石家庄网站建设找哪家好
  • 南通外贸网站推广自在源码网官网
  • 个人网站模板html下载餐饮vi设计案例欣赏
  • 高端网站建设wanghess网站开发售后服务承诺
  • 江西网站建设费用企业网站推广的方法有( )
  • 中国十大网站开发公司企业网站建设的要素有哪些
  • 网站防站做网站吉林
  • 嘉定区网站建设公司企业信息公示查询系统官网
  • 一个具体网站的seo优化产品介绍网站模板下载地址
  • 怎么做网站在网上能搜到你哈尔滨网站建立公司
  • 做家旅游的视频网站上海百度公司总部
  • 微信小程序公司网站怎么制作区块链平台定制开发
  • 网站资质优化ip地址域名解析