欢迎来到代码驿站!

vue

当前位置:首页 > 网页前端 > vue

bootstrap vue.js实现tab效果

时间:2021-06-09 08:05:53|栏目:vue|点击:

本文实例为大家分享了bootstrap vue.js实现tab效果的具体代码,供大家参考,具体内容如下

项目目录结构

Student.js代码

function Student(){
  this.baseInfo = {
    tabStatus : true ,
    name : '张三',
    sex : 'male'
  } ,
  this.parentsInfo = {
    tabStatus : false,
    fatherName : '张全蛋',
    motherName : '李铁柱'
  } ,
  this.studySituation = {
    tabStatus : false,
    classSort : 1,
    gradeSort : 2
  }
}

CommonUtil.js代码

Array.prototype.del = function(filter){
 var idx = filter;
 if(typeof filter == 'function'){
  for(var i=0;i<this.length;i++){
   if(filter(this[i],i)) idx = i;
  }
 }
 this.splice(idx,1)
}

var ary=[{id:1,name:"b"},{id:2,name:"b"}];
var delid = 2;
ary.del(function(obj){
 return obj.id == delid;
})

html页

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>Student Management</title>
  <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="external nofollow" >
  <script src="https://cdn.bootcss.com/jquery/3.1.1/jquery.js"></script>
  <script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
</head>
<body>
  <div id="stu" class="container">
    <ul class="nav nav-tabs">
      <li class="active"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >基本信息</a></li>
      <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >家长信息</a></li>
      <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >成绩查询</a></li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane fade in active">
        <table class="table">
          <tr>
            <td class="col-lg-2">姓名</td>
            <td class="col-lg-4">{{baseInfo.name}}</td>
            <td class="col-lg-2">性别</td>
            <td class="col-lg-4">{{baseInfo.sex}}</td>
          </tr>
        </table>
      </div>
      <div class="tab-pane fade in">
        <table class="table">
          <tr>
            <td class="col-lg-2">父亲名</td>
            <td class="col-lg-4">{{parentsInfo.fatherName}}</td>
            <td class="col-lg-2">母亲名</td>
            <td class="col-lg-4">{{parentsInfo.motherName}}</td>
          </tr>
        </table>
      </div>
      <div class="tab-pane fade in">
        <table class="table">
          <tr>
            <td class="col-lg-2">全班排名</td>
            <td class="col-lg-4">{{studySituation.classSort}}</td>
            <td class="col-lg-2">全级排名</td>
            <td class="col-lg-4">{{studySituation.gradeSort}}</td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</body>
<script src="js/Student.js"></script>
<script>
  var student = new Student();
  new Vue({
    el : '#stu',
    data : {
      baseInfo : student.baseInfo,
      parentsInfo : student.parentsInfo,
      studySituation : student.studySituation
    } ,
    method : {

    }
  })
</script>
</html>

上一篇:vue3.0中友好使用antdv示例详解

栏    目:vue

下一篇:关于Vue背景图打包之后访问路径错误问题的解决

本文标题:bootstrap vue.js实现tab效果

本文地址:http://www.codeinn.net/misctech/138201.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有