代码

<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. Finder是什么?Mac下的Finder有什么用?

    Finder是什么?Mac OS X系统下的Finder即相当于Windows系统下的"我的电脑"资源管理器.通过Finder,您能查看Mac 上几乎全部内容,包括应⽤软件.硬盘. ...

  2. 学PHP的第二天!

    这是我学PHP的第二天,我改了一些代码,终于把我喜欢的OJ网站的默认模板给改掉了,竟然能用!!!我从来都没有这么的欣喜过,看来PHP果真是一门非常好用的编程语言,但这个OJ有些用的是python的模块 ...

  3. 模态框拖拽案例分析--元素偏移量 offset 系列

    弹出框,我们也称为模态框. 模态框拖拽案例分析: (1)点击弹出层, 会弹出模态框, 并且显示灰色半透明的遮挡层. (2)点击关闭按钮,可以关闭模态框,并且同时关闭灰色半透明遮挡层. (3)鼠标放到模 ...

  4. 什么是spring框架

    一bai.概念:1. spring是开源的轻量级框架2 spring核心主要两部分:(1)aop:面向切面编程,扩展功能不是修改源代码实现(2)ioc:控制反转,- 比如有一个类,在类里面有方法(不是 ...

  5. EF getCookie

    table class="table table-bordered"> <thead> <tr> <td>商品名称</td> ...

  6. web端测试的测试点和注意事项【转载】

    文章来源:作者:simplesally 出处:https://www.cnblogs.com/simple1025/   [转载] 工作中接触了不同类型的web端系统,内容不同,需求不同,测试关注点也 ...

  7. vue 封装时间格式化和number精确度

    //format.js 公用js /** * Parse the time to string * @param {(Object|string|number)} time * @param {str ...

  8. springboot项目启动报错:找不到或无法加载主类 com....

    springboot项目报错 找不到或无法加载主类 com.... 1.如果是导入的别人的项目 首先要配置好JDK 和 MAVEN 然后点击右侧栏的maven图标 --->点击clean(清除掉 ...

  9. 使用idea从零编写SpringCloud项目-Ribbo

    git:https://github.com/bmdcheng/product_server git:https://github.com/bmdcheng/order_server 1.需要创建两个 ...

  10. 实验二 c语言中的表达式及输入输出函数编程应用

    1.    格式符%04d的作用是:在左边填充数字0,输出变量的所有数字且左对齐 #include <stdio.h>int main() { int num; scanf("% ...