小編給大家分享一下bootstrap vue.js實現tab效果的示例,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
Vue具體輕量級框架、簡單易學、雙向數據綁定、組件化、數據和結構的分離、虛擬DOM、運行速度快等優勢,Vue中頁面使用的是局部刷新,不用每次跳轉頁面都要請求所有數據和dom,可以大大提升訪問速度和用戶體驗。
具體內容如下
項目目錄結構
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>
以上是“bootstrap vue.js實現tab效果的示例”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。