<template>
<div>
<div class="navbox">
<div class="nav">
<mt-button size="small" v-for="(tab, i) in tabs" :class="{active01:tab.hasactive}" @click="forChageTag(i)" @click.native.prevent="active = tab.container">{{tab.title}}</mt-button>
<!--<mt-button size="small" @click.native.prevent="active = 'tab-container2'">tab 2</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container3'">tab 3</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container4'">tab 4</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container5'">tab 5</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container6'">tab 6</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container7'">tab 7</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container8'">tab 8</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container9'">tab 9</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container10'">tab 10</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container11'">tab 11</mt-button>
<mt-button size="small" @click.native.prevent="active = 'tab-container12'">tab 12</mt-button>-->
</div>
</div>
<div class="page-tab-container">
<mt-tab-container class="page-tabbar-tab-container" v-model="active" swipeable>
<mt-tab-container-item id="tab-container1">
<!-- cell组件 -->
<mt-cell v-for="n in 20" title="tab-container 1"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container2">
<!-- cell组件 -->
<mt-cell v-for="n in 5" title="tab-container 2"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container3">
<!-- cell组件 -->
<mt-cell v-for="n in 7" title="tab-container 3"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container4">
<!-- cell组件 -->
<mt-cell v-for="n in 10" title="tab-container 4"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container5">
<!-- cell组件 -->
<mt-cell v-for="n in 5" title="tab-container 5"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container6">
<!-- cell组件 -->
<mt-cell v-for="n in 7" title="tab-container 6"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container7">
<!-- cell组件 -->
<mt-cell v-for="n in 10" title="tab-container 7"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container8">
<!-- cell组件 -->
<mt-cell v-for="n in 5" title="tab-container 8"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container9">
<!-- cell组件 -->
<mt-cell v-for="n in 7" title="tab-container 9"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container10">
<!-- cell组件 -->
<mt-cell v-for="n in 10" title="tab-container 10"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container11">
<!-- cell组件 -->
<mt-cell v-for="n in 5" title="tab-container 11"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container12">
<!-- cell组件 -->
<mt-cell v-for="n in 7" title="tab-container 12"></mt-cell>
</mt-tab-container-item>
</mt-tab-container>
</div>
</div>
</template>

<script>
export default {
name: 'page-tab-container',
data() {
return {
active: 'tab-container1',
tabs: [{
title: '推荐',
container: 'tab-container1',
hasactive: true
}, {
title: '美文',
container: 'tab-container2',
hasactive: false
}, {
title: '健康',
container: 'tab-container3',
hasactive: false
}, {
title: '资讯',
container: 'tab-container4',
hasactive: false
}, {
title: '娱乐',
container: 'tab-container5',
hasactive: false
}, {
title: '搞笑',
container: 'tab-container6',
hasactive: false
}, {
title: '美图',
container: 'tab-container7',
hasactive: false
}, {
title: '美食',
container: 'tab-container8',
hasactive: false
}, {
title: '科技',
container: 'tab-container9',
hasactive: false
}, {
title: '文化',
container: 'tab-container10',
hasactive: false
}, {
title: '历史',
container: 'tab-container11',
hasactive: false
}, {
title: '财经',
container: 'tab-container12',
hasactive: false
}
]
};
},
methods:{
forChageTag (index){
console.log(index);
console.log(this.tabs.length);
var tablen = this.tabs.length;
for(var n = 0;n < tablen; n++){
if(n == index){
this.tabs[index].hasactive = true;
}else{
this.tabs[n].hasactive = false;
}
}
}
},

};
</script>

<style lang="stylus" scoped>
.item
display: inline-block
.navbox
position: fixed
left: 0
top: 0
z-index: 20
width: 100%
overflow-x: scroll
overflow-y: hidden
background-color: #fff
.nav
padding: 0 10px
width: 10000px
position: relative
background-color: #f6f8fa
box-shadow: 0 0 1px #b8bbbf
.mint-button--small
margin: 0 25px
padding: 0
.mint-button--default
color: #656b79
box-shadow: none
.mint-button
border-radius: 0
.active01
color: #f00
border-bottom: 4px solid #f00

.navbox::-webkit-scrollbar
display: none

</style>

vue2.0+mint-ui资讯类顶导航和内容页联动实例(不是很完美)的更多相关文章

  1. vue2.0+mint-ui 仿资讯类顶导航内容联动优化

    <template><div><div class="navbox"><div class="nav" id=&quo ...

  2. vue2.0 + Element UI + axios实现表格分页

    注:本文分页组件用原生 html + css 实现,element-ui里有专门的分页组件可以不用自己写,详情见另一篇博客:https://www.cnblogs.com/zdd2017/p/1115 ...

  3. vue2.0+Element UI 实现动态表单(点击按钮增删一排输入框)

    对于动态增减表单项,Element UI 官方文档表单那一节已经介绍得很清楚了,我之前没有看见,绕了很多弯路,这里针对点击按钮增删一排输入框的问题做一个总结. 效果图如下 存在一排必填的姓名与手机号, ...

  4. vue2.0 + element ui 实现表格穿梭框

    element ui 官网里介绍了穿梭框(Transfer),但在实际使用过程中,会出现一些问题: 1.穿梭框里能放置的内容太少,不能满足复杂的业务需求. 2.当选项过多时,穿梭框很难实现分页,左右两 ...

  5. vue2.0+Element UI 表格前端分页和后端分页

    之前写过一篇博客,当时对element ui框架还不太了解,分页组件用 html + css 自己写的,比较麻烦,而且只提到了后端分页 (见 https://www.cnblogs.com/zdd20 ...

  6. vue2.0 仿手机新闻站(六)详情页制作

    1.结构 2.配置详情页路由 router.config.js /** * 配置 路由 */ // 导入组件 import Home from './components/Home.vue' impo ...

  7. vue 专题 vue2.0各大前端移动端ui框架组件展示

    Vue 专题 一个数据驱动的组件,为现代化的 Web 界面而生.具有可扩展的数据绑定机制,原生对象即模型,简洁明了的 API 组件化 UI 构建 多个轻量库搭配使用 请访问链接: https://ww ...

  8. iOS开发之资讯类App常用分类控件的封装与实现(CollectionView+Swift3.0+)

    今天博客中,我们就来实现一下一些常用资讯类App中常用的分类选择的控件的封装.本篇博客中没有使用到什么新的技术点,如果非得说用到了什么新的技术点的话,那么勉强的说,用到了一些iOS9以后UIColle ...

  9. vue2.0实现底部导航切换效果

    使用vue2.0写移动端的时候,经常会写底部导航效果,点击切换路由效果,实现图片和文字颜色切换.vue2.0也提供了很多ul框架供我们实现效果,今天就用原生的实现一个底部导航切换,直接上代码: 效果图 ...

随机推荐

  1. liunx 之 Ubuntu 网速慢解决方法

    打开终端依次输入以下指令: sudo lshw -numeric -class network sudo ip addr show sudo ip route show sudo tracepath ...

  2. mac OS Apache Tomcat 启动/停止服务

    进入Tomcat下的bin目录 启动Tomcat命令 ./startup.sh Tomcat 默认端口 8080 停止Tomcat服务命令 ./shutdown.sh 执行tomcat ./shutd ...

  3. 深入认识CSS的块级元素

    2019独角兽企业重金招聘Python工程师标准>>> 块级元素: 显示在一块内,会自动换行,元素会从上到下垂直排列,各自占一行.每个块级元素默认占一行高度,一行内添加一个块级元素后 ...

  4. 谈谈你对vuex的理解

    vuex创建公有仓库的插件 1.储存公共状态 2.能够根据事件来修改状态 3.多个组件都需要变化,有机制把这个新的状态通知给所有的组件 vuex中的四个类 1.state    定义需要共享的状态 2 ...

  5. 上传组件Fine Uploader在ASP.NET中的应用

    现如今,世面上流行着许多前端上传组件,例如:Uploadify(http://www.uploadify.com/),Fine Uploader,等等.这篇博客从头开始,介绍如何在ASP.NET MV ...

  6. Jmeter 结构体系及运行顺序

    一.Jmeter 运行原理: Jmeter 时以线程的方式来运行的(由于Jmeter 是 java 开发的所以是运行在 JVM 虚拟机上的,java 也是支持多线程的) 二.Jmeter 结构体系 1 ...

  7. predixy源码学习

    Predixy是一个代理,代理本质上就是用来转发请求的.其主要功能就是接收客户端的请求,然后把客户端请求转发给redis服务端,在redis服务端处理完消息请求后,接收它的响应,并把这个响应返回给客户 ...

  8. 3) drf 框架生命周期 请求模块 渲染模块 解析模块 自定义异常模块 响应模块(以及二次封装)

    一.DRF框架 1.安装 pip3 install djangorestframework 2.drf框架规矩的封装风格 按功能封装,drf下按不同功能不同文件,使用不同功能导入不同文件 from r ...

  9. Java采用反射技术创建对象后对目标类的成员变量和成员方法进行访问

    实现: package com.ljy; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * * @Class ...

  10. 多阶段构建Golang程序Docker镜像

    Docker简介 Docker是基于Linux容器技术(LXC),使用Go语言实现的开源项目,诞生于2013年,遵循Apache2.0协议.Docker自开源后,受到广泛的关注和讨论. Docker在 ...