<template>
<div class="tab-control">
<div v-for="(item , index) in title" class="tab-control-item"
:class="{active: index === currentIndex}" @click='itemClick(index)'>
<span>{{item}}</span>
</div>
</div>
</template> <script>
export default {
name: 'TabControl',
data:{
title:["新款" , "流行" , "推荐"]
}
}
},
data(){
return{
currentIndex: 0
}
},
methods: {
itemClick(index){
this.currentIndex = index;
this.$emit('tabClick', index)
}
},
}
</script> <style scoped>
.tab-control{
display: flex;
text-align: center;
font-size: 15px;
height: 40px;
line-height: 40px;
background-color: #fff;
} .tab-control-item{
flex:1;
} .tab-control-item span{
padding: 5px;
} .active{
color: deeppink
} .active span{
border-bottom: 3px solid deeppink;
} .tab-control{
position: sticky;
top: 44px
}
</style>

最新文章

  1. 如何使用yum 下载 一个 package ?如何使用 yum install package 但是保留 rpm 格式的 package ? 或者又 如何通过yum 中已经安装的package 导出它,即yum导出rpm?
  2. oracle用户创建及权限设置
  3. Android——GridLayout
  4. codevs 1078 最小生成树
  5. Word Pattern
  6. 数据结构(线段树):BZOJ 1018: [SHOI2008]堵塞的交通traffic
  7. Ajax请求安全性讨论 - Eric.Chen(转)
  8. WPF中控件ListView和DataGrid典型属性介绍
  9. java foreach实现原理
  10. 流水线技术原理和Verilog HDL实现(转)
  11. DDD理论学习系列(10)-- 聚合
  12. Akka(17): Stream:数据流基础组件-Source,Flow,Sink简介
  13. 计算理论:NFA转DFA的两种方法
  14. Django Cookie和Seesion
  15. git branch 不显示的原因
  16. MFC中运行出现问题“不支持尝试执行的操作”
  17. iOS 转换异步block为同步方式运行
  18. App.config和Web.config配置文件的配置节点的解析
  19. Jquery、Ajax实现新闻列表页分页功能
  20. Pairwise

热门文章

  1. 一文带你学会国产加密算法SM4的vue实现方案
  2. C# Sign In With Apple苹果登陆后端验证
  3. Redux:store
  4. 微信小程序实战篇-电商(一)
  5. 微信小程序-视频弹幕的项目
  6. How to delete the eclipse plugin.
  7. apache.zookeeper-3.4与apache.kafka-2.11的安装
  8. jquery live 区别
  9. Word与Excel中,如何输入✔标志
  10. 【Redis】List常见应用场景