vue轮播,展示pdf

根据左侧图片格式,右侧展示相应的pdf文件与图片。(vue中不支持pdf格式,pdf文件要放在static文件里);代码如下:

 <template>
<!-- 户图件展示 -->
<div id="houseImgBox">
<!-- 左侧img图片 -->
<div class="leftlList">
<GeminiScrollbar class="my-scroll-bar">
<div v-for="(item,index) in leftImgs" class="activedImg">
<label>{{index+1}}</label>
<div @click="clickImg(item)" :class="[leftItem == item ? 'listImgActived': 'img']">
<img v-if="item.fileType =='pdf'" src="pdf.jpg" />
<img v-else :src="item.fileUrl" />
</div>
</div>
</GeminiScrollbar>
</div>
<!-- 分割线 -->
<div class="string"></div>
<!-- 中间展示的图片 -->
<div class="centerImg">
<img :src="fileUrl" v-show="fileType=='image'" />
<iframe v-show="fileType=='pdf'" :src="fileUrl" frameborder="0" width="100%" height="100%"></iframe>
</div>
</div>
</template> <script>
export default {
name: "right",
components: {},
beforeCreate: function() {},
mounted: function() {
//this.leftImgs = houseImg;
if (this.leftImgs.length > 0) {
this.fileUrl = this.leftImgs[0].fileUrl;
this.fileType = this.leftImgs[0].fileType;
this.fileName = this.leftImgs[0].fileName;
}
},
data() {
return {
fileUrl: "",
fileType: "image",
fileName: "",
leftItem: 0,
leftImgs: [
{
fileUrl:
"a.jpg",//写你自己的路径信息
fileName: "房屋分户图",
fileType: "image"
},
{
fileUrl:
"a.jpg",//写你自己的路径信息
fileName: "房屋分户图",
fileType: "image"
},
{
fileUrl: "test1.pdf",//写你自己的路径信息
fileName: "ffffff",
fileType: "pdf"
},
{
fileUrl:
"b.jpg",//写你自己的路径信息
fileName: "宗地图",
fileType: "image"
},
{
fileUrl:
"c.jpg",//写你自己的路径信息
fileName: "房屋平面图",
fileType: "image"
}
]
};
},
methods: {
clickImg(item) {
this.leftItem = item;
this.fileUrl = item.fileUrl;
this.fileType = item.fileType;
this.fileName = item.fileName;
}
}
};
</script> <style scoped>
.leftlList {
color: white;
position: absolute;
margin-top: 40px;
margin-left: 40px;
width: 190px;
height: calc(100% - 80px);
} .leftlList div .img,
.listImgActived {
display: inline-block;
margin: 16px 14px;
text-align: center;
vertical-align: middle;
width: 130px;
height: 130px;
line-height: 130px;
border: 2px solid gray;
}
.leftlList div .img > img,.listImgActived img{
width: 100%;
height: 100%;
} #app .string {
position: absolute;
margin-left: 220px;
margin-top: 40px;
height: calc(100% - 80px);
border: 2px solid gray;
display: inline-block;
} .centerImg {
position: absolute;
width: calc(100% - 430px);
margin-left: 300px;
margin-top: 70px;
text-align: center;
vertical-align: middle;
height: calc(100% - 20%);
}
.centerImg img {
width: 100%;
height: 100%;
} .listImgActived {
border: 2px solid aqua !important;
} .my-scroll-bar {
height: 100%;
}
</style>

如有疑惑,请加群讨论。

vue轮播,展示pdf的更多相关文章

  1. 图片轮播展示效果-2D实现

    图片的轮播展示效果如果使用2D实现,需要将3D中存在的近大远小效果使用图片的缩放呈现,因此需要存储和计算图片的位置同时还要计算存储图片的缩放信息.将所有图片的位置连线看作是一个椭圆,就可以根据图片的个 ...

  2. vue轮播组件及去掉路由#

    最近公司要我去实现vue知识的系统讲解,总结一番,大致需要7节课,今天大致说一下我们使用vue需要学会的基本技能.vue是一个渐进性视图渲染框架,使用vue核心是数据出发,数据一般是我们前台从后台获取 ...

  3. vue轮播图实现

    1.先安装组件 cnpm install vue-awesome-swiper; 2.在main.js下引入文件: import VueAwsomeSwiper from 'vue-awesome-s ...

  4. vue轮播图插件vue-awesome-swiper的使用与组件化

    不管是APP还是移动端网页开发,轮播图在大部分项目当中都是存在的,这时候如果用vue开发项目,选择一款好的插件并且封装好是很重要的 1. 推荐使用vue-awesome-swiper 安装:cnpm ...

  5. vue轮播(完整详细版)

    轮播组件vue <swiper :options="swiperOption" class='swiper-box'>     <swiper-slide v-f ...

  6. vue轮播图

    vue开发中遇到这样一个需求实现导航栏和中间内容相结合实现页面滑动导航跟随改变的效果.看效果: 这里我用的是vue所带的插件:vue-awesome-swiper,传送门:https://www.np ...

  7. vue轮播,不是只有左右切换的,还有只切换src的

    在项目中,初次接触vue,看了轮播插件vue-swiper等,好多都是左右切换的.个人强迫症比较严重,就要单页切换样式,就手写了一个. 功能:自动轮播,上一页下一页,点击小圆点切换大图.基本轮播要求的 ...

  8. vue轮播插件vue-awesome-swiper

    https://surmon-china.github.io/vue-awesome-swiper/ 第一步安装 npm install vue-awesome-swiper --save 第二部在m ...

  9. Vue轮播图插件---Vue-Awesome-Swiper

    轮播图插件 Vue-Awesome-Swiper 地址:https://github.com/surmon-china/vue-awesome-swiper 安装:npm install vue-aw ...

随机推荐

  1. vue 点击其他地方隐藏dom

    document.addEventListener('click', function (e) { if (document.getElementsByClassName('keywordContai ...

  2. SAP内表查询速度优化实例-OPEN SQL

    一.FOR ALL ENTRIES IN 案例 今天碰到工单报工统计分析表查询速度特别慢 经查看源代码: SELECT afpo~dwerk afko~aufnr afpo~matnr AS plnb ...

  3. poj3468 A Simple Problem with Integers (树状数组做法)

    题目传送门 A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 1 ...

  4. js 中的深拷贝与浅拷贝

    在面试中经常会问到js的深拷贝和浅拷贝,也常常让我们手写,下面我们彻底搞懂js的深拷贝与浅拷贝. 在js中 Array 和 Object  这种引用类型的值,当把一个变量赋值给另一个变量时,这个值得副 ...

  5. JavaWeb的几种设计模式

    原文:http://blog.csdn.net/yue7603835/article/details/7479855 Java Web开发方案有多种可供选择,这里列举一些经典的开发模式进行横向比较,为 ...

  6. openface人脸识别框架

    openface的githup文档地址:http://cmusatyalab.github.io/openface/ openface的安装: 官方推荐用docker来安装openface,这样方便快 ...

  7. Ubuntu下下载使用sublime

    使用Sublime真心很舒服.安装方法很简单,如下 进入官网http://www.sublimetext.com/2下载你的Sublime Text 2,然后解压文件. 把解压后得到的文件移动到/us ...

  8. 第11篇Kubernetes部署微服务电商平台

        kubernetes部署sock-shop微服务电商平台: 准备条件   确保kubernetes可以访问:reg.yunwei.edu镜像库   需要准备镜像:       部署微服务   ...

  9. jQuery查阅api手册

    原文&出处:jQuery API 3.3.1 速查表  --作者:Shifone http://jquery.cuishifeng.cn/

  10. OpenLayers API整理

    整理的Openlayers 的知识笔记,随着运用不断加深理解,也会不断更新. 本文链接:Openlayers API整理 作者:狐狸家的鱼 GitHub:八至 一.创建地图 1.地图Map 创建地图底 ...