基于vue實(shí)現(xiàn)分頁(yè)效果
本文實(shí)例為大家分享了vue實(shí)現(xiàn)分頁(yè)效果展示的具體代碼,供大家參考,具體內(nèi)容如下
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>分頁(yè)練習(xí)</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>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
詳解Vue微信授權(quán)登錄前后端分離較為優(yōu)雅的解決方案
這篇文章主要介紹了詳解Vue微信授權(quán)登錄前后端分離較為優(yōu)雅的解決方案,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-06-06
vue3+ant?design的form數(shù)組表單校驗(yàn)方法
這篇文章主要介紹了vue3+ant?design的form數(shù)組表單,如何校驗(yàn),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2023-09-09
解決elementui導(dǎo)航折疊卡頓的問(wèn)題
這篇文章主要介紹了解決elementui導(dǎo)航折疊卡頓的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-07-07
vue2使用wangeditor實(shí)現(xiàn)手寫(xiě)輸入功能
這篇文章主要為大家詳細(xì)介紹了vue2如何使用wangeditor實(shí)現(xiàn)手寫(xiě)輸入功能,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,感興趣的小伙伴可以了解下2023-12-12
vue3+Naive?UI數(shù)據(jù)表格基本使用方式詳解
這篇文章主要給大家介紹了關(guān)于vue3+Naive?UI數(shù)據(jù)表格基本使用方式詳?shù)南嚓P(guān)資料,Naive?UI是一個(gè)基于Typescript開(kāi)發(fā)的針對(duì)Vue3開(kāi)發(fā)的UI組件庫(kù),由TuSimple(圖森未來(lái))公司開(kāi)發(fā)并開(kāi)源,需要的朋友可以參考下2023-08-08
使用element-ui的Pagination分頁(yè)的注意事項(xiàng)及說(shuō)明
這篇文章主要介紹了使用element-ui的Pagination分頁(yè)的注意事項(xiàng)及說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-02-02
vscode 插件開(kāi)發(fā) + vue的操作方法
這篇文章主要介紹了vscode 插件開(kāi)發(fā) + vue的操作方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-06-06

