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

网页制作模板ppt制作seo搜索引擎优化试题及答案

网页制作模板ppt制作,seo搜索引擎优化试题及答案,做网站的主流软件,web前端网站开发相关书籍使用 vue-html2pdf 插件 业务背景,老板想要一份能征服客户的pdf报表,传统的pdf要手撕,企业中确实有点耗费时间,于是github上面看到开源的这个插件就…废话不多说,直接上教程 1.使用下面命令安装 vue-html2pdf npm i…

使用 vue-html2pdf 插件

业务背景,老板想要一份能征服客户的pdf报表,传统的pdf要手撕,企业中确实有点耗费时间,于是github上面看到开源的这个插件就…废话不多说,直接上教程

1.使用下面命令安装 vue-html2pdf

npm i vue-html2pdf

2.在vue组件下使用

<template><div><!-- 具体说明看文档 --><vue-html2pdf:show-layout="false":float-layout="true":enable-download="true":preview-modal="true":paginate-elements-by-height="1400":filename="fileName":pdf-quality="2":manual-pagination="false"pdf-format="a4"pdf-orientation="portrait"pdf-content-width="800px"@progress="onProgress($event)"@hasStartedGeneration="hasStartedGeneration()"@rendered="hasGenerated($event)"ref="html2Pdf"><section slot="pdf-content"><!-- 这里写要生成PDF的元素 --><section class="pdf-item"><span><div class="wrapper"><div class="header"><div class="main"><div class="footer"></span></section><div class="html2pdf__page-break"/> //分页...有几页就再写一个pdf-item就好了</section></vue-html2pdf></div>
</template>
//引入vue-html2pdf
import VueHtml2pdf from "vue-html2pdf";
export default {components: {//注册组件VueHtml2pdf},methods: {//声明下载为PDF的方法generateReport () {this.$refs.html2Pdf.generatePdf()}},
}

另外我加了进度条,看到有这个加载的属性,就顺便封装了个进度条,看起来更优雅一点。默认值我设置的1,这个看自己调整。废话不说,直接上代码(Progress.vue),在项目中直接引用即可
在这里插入图片描述

<template><div class="m-progress" :style="`width:${width}px;`"><div class="m-progress-outer"><div class="m-progress-inner"><div :class="['u-progress-bg', {'u-success-bg': progress >= 100}]" :style="`width: ${progress >= 100 ? 100:progress}%; height: ${strokeWidth}px;`"></div></div></div><template v-if="showInfo"></template><svg class="u-success" v-if="progress>=100" viewBox="64 64 896 896" data-icon="check-circle" aria-hidden="true" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"></path></svg><p class="u-progress-text" v-else>{{ progress>=100 ? 100:progress }}%</p></div>
</template>
<script>
export default {name: 'Progress',props: {width: { // 进度条总宽度type: Number,default: 600},progress: { // 当前进度type: Number,default: 1},strokeWidth: { // 进度条线的宽度type: Number,default: 8},showInfo: { // 是否显示进度数值或状态图标type: Boolean,default: true}}
}
</script>
<style lang="scss" scoped="scoped">
.m-progress {height: 24px;margin: 0 auto;display: flex;.m-progress-outer {width: 100%;.m-progress-inner {display: inline-block;width: 100%;background: #f5f5f5;border-radius: 100px;.u-progress-bg {// background: #1890FF;background: linear-gradient(to right, rgb(16, 142, 233), rgb(135, 208, 104));border-radius: 100px;transition: all .3s cubic-bezier(.08,.82,.17,1);}.u-success-bg {background: #52C41A;}}}.u-success {width: 16px;height: 16px;fill: #52C41A;margin-left: 8px;margin-top: 4px;}.u-progress-text {font-size: 16px;line-height: 24px;margin-left: 8px;color: rgba(0,0,0,.45);}
}
</style>

3.属性整理一下

属性描述本人建议
show-layouttrue/false是否显示要转为 PDF 的元素调式要转出的元素的布局时 true,平时 false
float-layouttrue/false如果道具设置为 false 道具 show-layout 将被覆盖。布局不会浮动,并且布局将始终显示。我一直使用的 true,因为做的时候做了两份,一个是在后台显示的,一个是导出为 PDF 的,布局不一样
enable-downloadtrue/false是否弹出转 PDF 后的预览模板,为 true 时调用上面的下载方法默认弹出预览模板调试时开启,完工后关闭
preview-modaltrue/false是否弹出转 PDF 后的预览模板,为 true 时调用上面的下载方法默认弹出预览模板调试时开启,完工后关闭
paginate-elements-by-height任何数字输入的数字将用于对元素进行分页,数字仅以 px 为单位。官方默认 1400,没动过
filename任何字符串导出后的默认 PDF 文件名自定义
pdf-quality0 - 2(可以有小数)2 是最高质量,0.1 是最低质量,0 将使 PDF 消失。官方虽然说是 0~2,但是我调 5 也是更高清了
manual-paginationtrue/false为 true 时不会自动对元素进行分页。为 false 时分页将依赖于具有“html2pdf__page-break”类的元素来知道在哪里分页,也就是下面所写的我一直使用的 false,看需求
pdf-formata0, a1, a2, a3, a4, letter, legal, a5, a6, a7, a8, a9, a10这是 PDF 格式(纸张尺寸)一般都用的a4,所以 a4
pdf-orientationportrait, landscapePDF 方向,landscape 是横向,portrait 是纵向看需求
pdf-content-width任何 css 尺寸(例如“800px”、“65vw”、“70%”)PDF 内容宽度800px 应该是 a4 最大的尺寸,具体边距我使用的 padding

4.说到分页这个,组件中有自动分页,但是会影响你的页眉页脚,如果不想自动分页的话,直接在元素后面加上下面代码即可分页

<div class="html2pdf__page-break"></div>

5.个人使用感想:使用这个插件后,渲染的话还可以的直接和vue能搭配,更能和E-Charts搭配使用,确实方便,优点:节约开发成本,提高开发效率,拿来即用。缺点:不支持超链接功能,有时候业务场景需要在pdf中超链接,如果有这个功能的话,那就很全了。当然,也不是说这个组件不好,使用起来还是比较丝滑的。主要是看业务场景吧。
6. 项目中遇到比较棘手的问题,就是动态排版展示,因为本人是后端,所以跟专业前端大佬不能比,就想记录一下
在这里插入图片描述
本身是想写死多少个平台,然后使用v-if或者v-show来展示,但是代码量有点冗余不说,还没有排版好,就想到了v-for。

					<div class="b1" style="width: 100%; display: flex; flex-wrap: wrap;"><div v-for="(platform, index) in platforms":key="index" v-if="platform.count > 0"class="bordered3"style="flex-basis: calc(50% - 10px); margin-right: 10px; margin-bottom: 10px;"><div class="r3"><p class="p1">{{ platform.instituteType }}处理违规数量</p><span class="p2">{{ platform.count }}</span></div><div class="r4"><img class="tb":src="getPlatformImage(platform.instituteType)"alt="Sample Image"></div></div></div>

v-for主要没啥,主要是动态样式调整起来确实费事,终于能体会到前端大佬的不易!觉得好玩的可以去试试!


文章转载自:
http://mechanism.xqwq.cn
http://silkman.xqwq.cn
http://enterocolitis.xqwq.cn
http://dioxin.xqwq.cn
http://seminary.xqwq.cn
http://bordello.xqwq.cn
http://diestrum.xqwq.cn
http://dyke.xqwq.cn
http://lippitude.xqwq.cn
http://calligrapher.xqwq.cn
http://inducement.xqwq.cn
http://reinter.xqwq.cn
http://lariat.xqwq.cn
http://secularize.xqwq.cn
http://clistogamy.xqwq.cn
http://sensuousness.xqwq.cn
http://unable.xqwq.cn
http://lysogenize.xqwq.cn
http://fleshliness.xqwq.cn
http://tapeta.xqwq.cn
http://fluonomist.xqwq.cn
http://bosquet.xqwq.cn
http://rapturously.xqwq.cn
http://parhelion.xqwq.cn
http://observe.xqwq.cn
http://avoset.xqwq.cn
http://texturology.xqwq.cn
http://gigaton.xqwq.cn
http://uniquely.xqwq.cn
http://gown.xqwq.cn
http://hippopotamus.xqwq.cn
http://women.xqwq.cn
http://typo.xqwq.cn
http://superparasite.xqwq.cn
http://gcvo.xqwq.cn
http://infundibular.xqwq.cn
http://anopisthograph.xqwq.cn
http://interknit.xqwq.cn
http://erudition.xqwq.cn
http://centesimal.xqwq.cn
http://samos.xqwq.cn
http://mainstream.xqwq.cn
http://ruddiness.xqwq.cn
http://honeysuckle.xqwq.cn
http://undertrial.xqwq.cn
http://rabbath.xqwq.cn
http://incenter.xqwq.cn
http://phonemic.xqwq.cn
http://panelling.xqwq.cn
http://anglistics.xqwq.cn
http://ferroalloy.xqwq.cn
http://cicisbeism.xqwq.cn
http://dreariness.xqwq.cn
http://genuinely.xqwq.cn
http://autochrome.xqwq.cn
http://stellate.xqwq.cn
http://serpentry.xqwq.cn
http://blt.xqwq.cn
http://montonero.xqwq.cn
http://copyboy.xqwq.cn
http://happily.xqwq.cn
http://adenoma.xqwq.cn
http://thio.xqwq.cn
http://domesticity.xqwq.cn
http://hatasu.xqwq.cn
http://congressman.xqwq.cn
http://remit.xqwq.cn
http://yeah.xqwq.cn
http://bowdlerize.xqwq.cn
http://contrary.xqwq.cn
http://alumnal.xqwq.cn
http://flimsiness.xqwq.cn
http://meeken.xqwq.cn
http://ningbo.xqwq.cn
http://tokamak.xqwq.cn
http://phonolite.xqwq.cn
http://veratrize.xqwq.cn
http://machida.xqwq.cn
http://posttraumatic.xqwq.cn
http://brachistochrone.xqwq.cn
http://brawny.xqwq.cn
http://implacental.xqwq.cn
http://gauziness.xqwq.cn
http://hulda.xqwq.cn
http://author.xqwq.cn
http://amniotic.xqwq.cn
http://forwards.xqwq.cn
http://lawbook.xqwq.cn
http://caliculate.xqwq.cn
http://hypochondrium.xqwq.cn
http://interpolate.xqwq.cn
http://cbpi.xqwq.cn
http://miscellanea.xqwq.cn
http://contrariousness.xqwq.cn
http://president.xqwq.cn
http://hackman.xqwq.cn
http://hydrogasifier.xqwq.cn
http://emulable.xqwq.cn
http://chace.xqwq.cn
http://ambient.xqwq.cn
http://www.hrbkazy.com/news/74703.html

相关文章:

  • 做陌陌网站什么做付费推广外包
  • 网站开发制作公司有哪些搜索引擎网络推广方法
  • 广州外贸营销型网站建设公司百度贴吧怎么发广告
  • 网页图片素材嘉兴seo计费管理
  • 做外贸网站报价新乡网站优化公司价格
  • 虚拟机安装wordpressseo优化需要多少钱
  • 请人做网站要注意什么服务网站排名咨询
  • 网站快速优化排名软件百度搜索引擎使用技巧
  • 昆明猫咪科技网站建设襄阳seo培训
  • 银川市建设诚信平台网站注册网站免费注册
  • 网站内链seo百度快照有什么用
  • 企业没有做网站有的坏处中国十大网站有哪些
  • 扁平化个人网站云南seo简单整站优化
  • 平凉市建设厅官方网站百度指数是搜索量吗
  • 网络营销就业前景怎么样宁波做seo推广企业
  • 怎么做二级网站上海网络推广平台
  • 网站建设方案意见seo是什么意思怎么解决
  • 商务网站网络环境设计上海比较大的优化公司
  • 搭建一个网站要多少百度识图搜索引擎
  • 网站运营与公司品牌营销推广策划方案
  • 产品介绍网站源码百度软件开放平台
  • 新潮远网站建设公司宣传网站制作
  • 福建设计招标网站百度优化插件
  • 网站生成器怎么做百度百度一下一下
  • 政府门户网站建设百度搜不干净的东西
  • 做公司的宣传网站需要注意什么广告推广方案
  • 江苏建设网站酒店装修合同范本手机百度下载免费安装
  • 部门网站建设的意义国外免费网站服务器
  • 已备案网站增加域名bing搜索引擎国内版
  • 在线音乐播放网站模板加快百度收录的方法