用vue实现列表分页和按钮操作
为中华之崛起而读书
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
</head> <body>
<div id="t">
<table>
<tr>
<td>id</td>
<td>name</td>
<td>操作</td> </tr>
<tr v-for="k in list">
<td>{{k.uid}}</td>
<td>{{k.uname}}</td> <td>{{k.status}}</td> <td> <input type="button" @click="a()" v-if="k.status==0" value="保存"/>
<input type="button" v-on:click="b()" v-if="k.status==1" value="舍弃"/>
</td> </tr> </table>
<span v-if="this.current>1">
<input type="button" v-on:click="fnone()" v-if="true" value="首页"/> </span>
<span v-if="this.current-1>=1">
<input type="button" v-on:click="fnprev()" v-if="true" value="上一页"/> </span>
<span v-if="this.current+1<=total"> <input type="button" v-on:click="fnnext()" v-if="true" value="下一页"/>
</span>
<span v-if="this.current!=total"> <input type="button" v-on:click="fnlast()" v-if="true" value="尾页"/>
</span> </div> </body>
<script>
var nv=new Vue({
el:"#t",
data:{ list:[],
current:1,
total:1 }, methods:{
fnnext:function(){
if(this.current+1<=this.total){
this.current=this.current+1;
this.fnboss();
} },
fnprev:function(){ if(this.current-1>=1){
this.current=this.current-1;
this.fnboss();
} },
fnone:function(){
this.current=1;
this.fnboss(); },
fnlast:function(){
this.current=this.total;
this.fnboss(); }, fnboss:function(){
axios.get(`http://localhost:8080/list/${this.current}`).then(obj=>{
console.log(obj);
this.list=obj.data.data.content;
this.total=obj.data.data.totalPages; }) } },
created:function(){
this.fnboss();
} }) </script>
</html>
用vue实现列表分页和按钮操作的更多相关文章
- Vue笔记--通过自定义指令实现按钮操作权限
经常做中后台系统,此类系统的权限是比较重要,拿自己做过的一些项目做个笔记. Vue实现的中后台管理系统.按钮操作权限的空置一般都是通过自定义指令Vue.directive. <el-button ...
- django rest_framework vue 实现用户列表分页
django rest_framework vue 实现用户列表分页 后端 配置urls # 导入view from api.appview.userListView import userListV ...
- vue+element-ui 实现分页(根据el-table内容变换的分页)
官方例子 官方提示: 设置layout,表示需要显示的内容,用逗号分隔,布局元素会依次显示.prev表示上一页,next为下一页,pager表示页码列表,除此以外还提供了jumper和total,si ...
- 为什么你需要在用 Vue 渲染列表数据时指定 key
本文改写整理自一篇博文,原文链接如下: Why you should use the key directive in Vue.js with v-for Application state and ...
- 基于Metronic的Bootstrap开发框架经验总结(2)--列表分页处理和插件JSTree的使用
在上篇<基于Metronic的Bootstrap开发框架经验总结(1)-框架总览及菜单模块的处理>介绍了Bootstrap开发框架的一些基础性概括,包括总体界面效果,以及布局.菜单等内容, ...
- PHP+jQuery 列表分页类 ( 支持 url 分页 / ajax 分页 )
/* ******* 环境:Apache2.2.8 ( 2.2.17 ) + PHP5.2.6 ( 5.3.3 ) + MySQL5.0.51b ( 5.5.8 ) + jQuery-1.8.3.mi ...
- JS-001-单选复选按钮操作
此文主要针对 web 页面中常见元素(例如:单选按钮.复选按钮)的 JavaScript 操作,进行简单的源码示例演示,敬请小主们参阅.若有不足之处,敬请大神指正,不胜感激! 话不多言了,直接上码: ...
- jsp 条件查询、列表分页
条件查询 dao //根据搜索条件筛选数据 public List<User> GetUserBySearch(String userName, String sex) throws SQ ...
- 微信小程序开发——列表分页上拉加载封装实现(订单列表为例,订单状态改变后刷新列表滚动位置不变)
业务需求: 业务需求是给订单列表添加分页功能,也就是上拉加载这种每次只请求加载固定数量的数据. 需求分析: 对业务来说就是简单的分页上拉加载,但是对于技术实现来说,除了要处理分页数据的累加加载,还要处 ...
随机推荐
- python - django 执行数据库迁移后数据库并未更新 和 InternalError: (1054, u"Unknown column 'xxx' in 'field list'")问题
一.发生情况:当你修改数据库结构后进行 python manage.py makemigrations 和 python manage.py migrate 后发现控制台会给你返回一个下面的结果,但是 ...
- Tensorflow细节-P312-PROJECTOR
首先进行数据预处理,需要生成.tsv..jpg文件 import matplotlib.pyplot as plt import numpy as np import os from tensorfl ...
- eclipse 配置python环境 json 插件
windows->install new software add 配置python 环境: name:pydev(可随意写) url:http://pydev.org/updates/ (如果 ...
- wget递归下载网站资源
wget -r -p -np -k http://archive.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/ 在下载https ...
- 微信浏览器中清缓存的方法---- http://debugx5.qq.com/
http://debugx5.qq.com/ 点击上面网址,然后把底部的四个选项打钩,然后点清除,即可把可恶的缓存清掉!!!!!
- 1-开发共享版APP(源码介绍)-BUG修复
这一系列文章将介绍APP的源码,这一节作为所有BUG问题修复! https://www.cnblogs.com/yangfengwu/category/1512162.html //开发共享版A ...
- SIGIR2018 Paper Abstract Reading Notes (1)
1.A Click Sequence Model for Web Search(日志分析) 更好的理解用户行为对于推动信息检索系统来说是非常重要的.已有的研究工作仅仅关注于建模和预测一次交互行为,例如 ...
- 洛谷P3177 树上染色
题目 一道非常好的树形DP. 状态:\(dp[u][n]\)为u的子树选n个黑点所能得到的收益最大值. 则最终的结果就是\(dp[root][k],\)\(root\)可以为任何值,为了方便,使\(r ...
- 结构体&文件
1.本章学习内容总结 1.1学习内容总结 什么是结构类型? 结构Structure类型是一种允许程序员把一些数据分量聚合成一个整体的数据类型. 结构和数组的区别? 结构和数组的最大区别是数组中所有元素 ...
- B. Heaters ( Codeforces Round #515 (Div. 3) )
题解:对于每个点 i 来说,从 j = i + r - 1 开始往前找,如果找到一个 a [ j ] 是 1 ,那么就把它选上,但是我们需要判断交界处,也就是如果前面选的那个可以让这个点变温暖,就不用 ...