用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 ...
- 微信小程序开发——列表分页上拉加载封装实现(订单列表为例,订单状态改变后刷新列表滚动位置不变)
业务需求: 业务需求是给订单列表添加分页功能,也就是上拉加载这种每次只请求加载固定数量的数据. 需求分析: 对业务来说就是简单的分页上拉加载,但是对于技术实现来说,除了要处理分页数据的累加加载,还要处 ...
随机推荐
- Nginx+keepalived 高可用双机热备(主从模式)
环境:centos7.6 最小化安装 主:10.11.1.32 从:10.11.1.33 VIP:10.11.1.130 修改主节点主机名: hostnamectl set-hostname web_ ...
- 学习:类和对象——对象模型和this指针
成员变量和成员函数分开存储: 在C++中,类内的成员变量和成员函数分开存储 第一点:空对象占用内存空间1个字节 第二点:只有非静态成员变量才属于类的对象上,非静态成员函数和静态成员函数和静态成员变量不 ...
- LeetCode 875. Koko Eating Bananas
原题链接在这里:https://leetcode.com/problems/koko-eating-bananas/ 题目: Koko loves to eat bananas. There are ...
- Postgresql operator does not exist: numeric = character varying
)),series_name from svcm_t_series_res: 原来series_id是numeric型,现在转换为varchar(64):
- php web开发——文件的上传和下载
PHP用超级全局变量数组$_FILES来记录文件上传相关信息的. 1.file_uploads=on/off 是否允许通过http方式上传文件 2.max_execution_time=30 允许脚本 ...
- 浅谈H5图片中object-fit的属性及含义/ 小程序image mode属性中scaleToFill,aspectFit,widthFix等类似
我们在H5中对于图片的属性包含如下: object-fit属性有哪些值呢? object-fit: fill; object-fit: contain; object-fit: cover; o ...
- learning svn diff --summarize
# svn diff --summarizeA armbian-custom-dc/test/4g-power.shA armbian-custom-dc/test/4g-reset.shM armb ...
- learning scala akka actorySystem create and close
package com.example import akka.actor.ActorSystem import scala.util.{Failure, Success} import scala. ...
- 奶牛抗议 DP 树状数组
奶牛抗议 DP 树状数组 USACO的题太猛了 容易想到\(DP\),设\(f[i]\)表示为在第\(i\)位时方案数,转移方程: \[ f[i]=\sum f[j]\;(j< i,sum[i] ...
- BZOJ 1213: [HNOI2004]高精度开根
二次联通门 : BZOJ 1213: [HNOI2004]高精度开根 正解 NTT+高精+倍增+二分 但是可以用python 2333333 m,n=int(raw_input()),int(raw_ ...