发表于: 2019-10-30 23:43:39
1 929
今天完成的事情:
1.今天设置给轮播图添加移动端的触摸事件,发现element的轮播图添加后失效,失效原因是overflow:hidden干扰,使得触摸事件无法在轮播图上起效,后来去找其他的组件,发现了有一个专门应用于vue移动端的组件库vant,里面有适合的触摸型轮播图:
<template>
<div class="articleContent">
<nav>
<img src="../assets/images/热门推荐/u538.svg" alt class="navImgLeft" />
<p class="navWord">搜索结果</p>
<img src="../assets/images/首页-视频1/u10.svg" alt class="navImgRight" />
</nav>
<div class="keyWord">
<span>年级选择</span>
<img src="../assets/images/首页-视频1/u42.svg" alt />
<input type="text" placeholder="请输入关键词" />
</div>
<van-swipe :autoplay="3000" :show-indicators="false">
<van-swipe-item v-for="(image, index) in images" :key="index">
<img :src="image" class="image" />
</van-swipe-item>
</van-swipe>
<main>
<router-view></router-view>
</main>
<footer>
<div class="foot">
<img src="../assets/images/首页-视频1/u15.svg" alt />
<p>首页</p>
</div>
<div class="foot">
<img src="../assets/images/首页-视频1/u20.svg" alt />
<p>学习</p>
</div>
<div class="foot">
<img src="../assets/images/首页-视频1/u19.svg" alt />
<p>论坛</p>
</div>
<div class="foot">
<img src="../assets/images/首页-视频1/u18.svg" alt />
<p>我的</p>
</div>
</footer>
</div>
</template>
<script>
export default {
name: "articleContent",
data() {
return {
page: null,
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg'
]
};
},
};
</script>
<style lang="scss" >
.articleContent {
nav {
position: fixed;
display: flex;
justify-content: space-between;
align-items: center;
top: 50px;
width: 100%;
height: 44px;
background-color: #f19c34;
z-index: 10;
.navImgLeft {
margin-left: 10px;
}
.navImgRight {
margin-right: 10px;
}
}
.keyWord {
position: relative;
margin-top: 80px;
padding: 0 10px;
img {
position: absolute;
left: 80px;
top: 50%;
width: 20px;
height: 14px;
margin-top: -7px;
}
input {
width: 70%;
height: 25px;
padding-left: 22px;
margin-right: 10px;
font-size: 14px;
border: 1px solid #aaa5a5;
border-radius: 5px;
outline: none;
}
}
.image{
width: 100%;
height: 200px;
}
footer {
position: fixed;
bottom: 0;
height: 49px;
display: flex;
justify-content: space-between;
align-items: center;
width: 90%;
padding: 0 5%;
background-color: #e3e3e3;
.foot {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
p {
margin: 0;
font-size: 12px;
}
}
}
}
</style>
明天计划:
1.继续写前台页面。
评论