代码

<template>
<div> <!-- 左侧的滑动模块 -->
<div
class="scroll-box"
:style="{width: 1106*screenWidth/1920+'px', height:336.52*screeHeight/1080+'px',top:130*screeHeight/1080+'px'}"
>
<div class="item" v-for="(item,index) of book" :key="index">
<div
class="boximg1"
:style="{width: 285.51*screenWidth/1920+'px', height:315.52*screeHeight/1080+'px',top:10*screeHeight/1080+'px',marginLeft:50*screenWidth/1920+'px'}"
> <div
class="boximg3"
:style="{width: 166.92*screenWidth/1920+'px', height:223.15*screeHeight/1080+'px',top:12*screeHeight/1080+'px'}"
>
<img
:src="item.bookImg"
:width="166.92*screenWidth/1920+'px'"
:height="223.15*screeHeight/1080+'px'"
>
</div> <div class="text" :style="{top:25*screeHeight/1080+'px'}">{{item.bookName}}</div>
</div>
</div>
</div> </div>
</template> <script>
export default {
data() {
return {
screenWidth: 1000, //宽屏幕尺寸
screeHeight: 1000,
book: [
{
id: 1,
zm: "A",
dc: "A",
dcfy: "ə",
zwfy: "a字母",
zwpy: "a",
dctp: "图片",
dcyp: "音频",
fiex01: null,
fiex02: null
},
{
id: 2,
zm: "A",
dc: "Alligator",
dcfy: "ˈælɪɡeɪtər",
zwfy: "鳄鱼",
zwpy: "è yú",
dctp: null,
dcyp: null,
fiex01: null,
fiex02: null
},
{
id: 3,
zm: "A",
dc: "Ant",
dcfy: "ænt",
zwfy: "蚂蚁",
zwpy: "mǎ yǐ",
dctp: null,
dcyp: null,
fiex01: null,
fiex02: null
},
{
id: 4,
zm: "A",
dc: "Apple",
dcfy: "ˈæpl",
zwfy: "苹果",
zwpy: "píng guǒ",
dctp: null,
dcyp: null,
fiex01: null,
fiex02: null
}
]
};
}, mounted() {
//获取屏幕长宽
(this.screenWidth = document.documentElement.clientWidth),
(this.screeHeight = document.documentElement.clientHeight),
(window.onresize = () => {
//屏幕尺寸变化就重新赋值
return (() => {
this.screenWidth = document.documentElement.clientWidth;
this.screeHeight = document.documentElement.clientHeight;
})();
});
}
};
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.scroll-box {
/* 给父盒子设置相对定位 */
position: relative;
/* position: relative; */
box-shadow: 0 0 5px 2px #25c985;
text-align: center;
white-space: nowrap;
overflow-y: scroll;
overflow-x: hidden;
/* 让父盒子水平居中
margin: 0 auto; */
}
/* 隐藏滚动条 */
::-webkit-scrollbar {
width: 0 !important;
}
::-webkit-scrollbar {
width: 0 !important;height: 0;
}
/* 横线滑动 */
.item {
white-space: nowrap;
display: inline-block;
}
.boximg1 {
/* 给父盒子设置相对定位 */
position: relative; box-shadow: 0 0 0 1px #0f0b00;
/* background: #f7aa05; */
/* margin:0 20px */
/* 边框圆角 */
border-top-right-radius: 10px;
border-top-left-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.boximg3 {
/* 给父盒子设置相对定位 */
position: relative;
display: flex;
/* 给父盒子设置相对定位 */
box-shadow: 0 0 0 2px #a09e9ee3;
background: hsl(60, 9%, 98%);
margin: 0 auto;
/* margin:0 20px */
}
.text {
/* 给父盒子设置相对定位 */
position: relative;
color: hsl(60, 9%, 98%);
font-size: 20px; -webkit-text-stroke: 0.2px rgb(15, 15, 15);
}
</style>

效果

vue横向滑动的更多相关文章

  1. 横向滑动页面,导航条滑动居中的 js 实现思路

    最近在做新闻咨询页的项目,各个新闻频道通过横向滑动切换,顶部的导航active栏需要跟着切换到对应频道,并且active到达中部时,要一直处在中间. 类似效果就是uc浏览器<UC头条>的导 ...

  2. 横向滑动的HorizontalListView滑动指定位置的解决方法

    项目中用到了自定义横向滑动的控件:HorizontalListView,点击其中一项,跳转到另外一个大图界面,大图界面也是HorizontalListView,想使用setSelection方法设定 ...

  3. UICollectionView 图片横向滑动居中偏移量的解决

    1.在使用UICollectionView 来显示横向滑动图片的时候,cell与cell之间有间隙,每次滑动后cell都会向左偏移,在使用过这两个方法才解决每次向左偏移的部分. 2.使用方法前不要开启 ...

  4. 使GridView可以单行横向滑动

    最近做的练手的小项目中存在一个横向滑动的问题,需要HorizontalScroll中嵌套GridView,但是GridView默认是竖直排放的item,况且HorizontalScroll与GridV ...

  5. ios7中使用scrollview来横向滑动图片,自动产生偏移竖向的偏移 问题

    ios7中使用scrollview来横向滑动图片,自动产生偏移竖向的偏移 问题     如图红色为scrollview的背景色,在scrollview上加了图片之后,总会有向下的偏移 设置conten ...

  6. android--解--它们的定义tabhost(动态添加的选项+用自己的主动性横向滑动标签+手势切换标签页和内容特征)

    在本文中,解决他们自己的定义tabhost实现,并通过代码集成动态加入标签功能.自己主动标签横向滑动功能.和手势标签按功能之间切换. 我完成了这个完美的解决方案一起以下: 1.定义tabwidget布 ...

  7. overflow-x: scroll;横向滑动详细讲解

    overflow-x: scroll;横向滑动(移动端使用详解) css3 , ie8以上 <!DOCTYPE html> <html lang="en"> ...

  8. 一个 Vue 的滑动按钮组件

    git 地址:https://github.com/SyMind/vue-sliding-button vue-better-slider 一个 Vue 的滑动按钮组件,有关滑动方面的处理借鉴 bet ...

  9. UITableView 的横向滑动实现

    UITableView 的横向滑动实现 概述 为了实现横向滑动的控件,可以继承类 UIScrollView 或类 UIView 自定义可以横向滑动的控件,这里通过 UITableView 的旋转,实现 ...

  10. 用css巧妙实现移动端横向滑动展示功能

    前言:记得以前处理移动端横向滑动展示都是去用js去解决的,要用js进行蛮多处理,要算li的宽度,然后还要用js设置ul盒子的宽度,又要设置最大滑动距离,最小滑动距离等等.......但是现在发现用cs ...

随机推荐

  1. Oracle 计划任务批量清理临时表实例

    昨天发现近一段时间,公司某oracle库数据泵方式备份比之前慢了很多,备份集大小并未增长太多.查看了下发现该用户下存在几十万张表. 一.问题分析 1.查看用户下面的表 select count(*) ...

  2. ping 请求找不到主机 www.baidu.com

    1.以管理员方式运行cmd 2.输入netsh winsock reset 3.重启电脑 4.如果还是不行,就删除C:\Windows\System32\drivers\etc里面的hosts文件试试 ...

  3. Centos7.5下安装nginx

    #cd /usr/local #wget http://nginx.org/download/nginx-1.8.0.tar.gz #tar -xzvf nginx-1.8.0.tar.gz #cd ...

  4. Pod资源的基础管理操作(Kubernetes)

    Pod是Kubernetes API中的核心资源类型,它可以定义在JSON或者YAML格式的资源清单中,由资源管理命令进行陈述式声明管理.创建时通过create或apply命令将请求提交到API Se ...

  5. Delphi中纤程的使用

    首先我们来看看纤程的定义 纤程(来自百科): 纤程是Windows为了将Unix服务程序更好的移植到Windows上而创建的, 线程是在Windows内核中实现的,纤程是在用户模式下实现的,内核对纤程 ...

  6. .NET Core使用 Coravel 实现任务调度

    前言 前段时间需要在一个新项目里添加两个后台任务,去定时请求两个供应商的API来同步数据:由于项目本身只是一个很小的服务,不太希望引入太重的框架,同时也没持久化要求:于是我开始寻找在Quartz.Ne ...

  7. c++实现单链表及常用方法实现

    来自https://blog.csdn.net/h294455907/article/details/80223345 这篇博客,做了一点小改动,用一个cpp实现的 #include<iostr ...

  8. 关于Centos7防火墙、端口、进程、开机自启、服务启动的常用命令

    一.防火墙相关命令 1.查看防火墙状态 : systemctl status firewalld.service 注:active是绿的running表示防火墙开启 2.关闭防火墙 :systemct ...

  9. vue组件淡入浅出动画

    点击动画 hello hello world! .test-enter, .test-leave-to { opacity: 0 } .test-enter-to, .test-leave { opa ...

  10. PNETLab添加锐捷镜像后无法使用telnet

    PNETLab 版本: 4.2.10 锐捷镜像版本: V1.03 故障详情: 使用PNETLab添加锐捷交换机.路由器镜像后,在Lab中添加设备,默认打开方式为telnet,telnet客户端无论是s ...