Posted in Javascript onNovember 06, 2017
本文实例为大家分享了vue实现分页效果展示的具体代码,供大家参考,具体内容如下
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>分页练习</title> <script src="js/vue.js"></script> </head> <style> .isList{ list-style:none; } .isPadding{ margin:5px; padding:5px; border:2px solid gray; } .isRed{ color:red; } </style> <body> <div id="container"> <p>{{msg}}</p> <ul v-bind:class="{isList:listStyle}"> <li v-for="(tmp,index) in pageNumbers" v-bind:style="{float:isFloat}" v-bind:class="{isPadding:isStyle,isRed:index==pageOne}" @click="changeBg(index)">{{tmp}}</li> </ul> </div> <script> new Vue({ el:"#container", data:{ msg:"Hello VueJs", listStyle:true, isFloat:"left", isStyle:true, pageNumbers:[1,2,3,4,5], pageOne:0 }, methods:{ changeBg:function(myIndex){ this.pageOne = myIndex; } } }) </script> </body> </html>
<!doctype html> <html> <head> <meta charset="UTF-8"> <title></title> <style> ul { list-style:none; } li{ padding:10px; margin:5px; border:1px solid gray; float:left; } .isRed{ color:red; } </style> <script src="js/vue.js"></script> </head> <body> <div id="container"> <p>{{msg}}</p> <ul> <li v-for="(tmp,index) in pageNumbers" v-bind:class="{isRed:index==pageNo}" @click="handleClick(index)">{{tmp}}</li> </ul> </div> <script> new Vue({ el:"#container", data:{ msg:"Hello VueJs", pageNumbers:[1,2,3,4,5], pageNo:0 }, methods:{ handleClick:function(myIndex){ this.pageNo = myIndex; } } }) </script> </body> </html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持三水点靠木。
基于vue实现分页效果
- Author -
匿名的girl声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@