20180227.修复BUG并实现关注、粉丝的pagination页码效果
2018-03-15 11:19
260 查看
20180227.修复BUG并实现关注、粉丝的pagination页码效果
作者: chenhaoting时间: 2018-02-27
分类: 科研项目日志
评论
之前的版本看似没问题,调试后发现出现很多新BUG,所以,需要换一下思路,
从后端改起将传递的json字符串改成一段而不是多段,
String result="";
for(int i=0;i<followList.size();i++){
result += followList.get(i).getName()+",";}
result_obj.addProperty("result", result);
前端再登录后发送异步请求获取:
this.$http.post('/api/UserManager/ReadFollow?name='+sessionStorage.getItem('login_user'))
.then((response)=>{ if(response.data.result){ sessionStorage.setItem('follow',response.data.result); } }) .catch(function(err){ console.log(err); });在对应的组件里添加钩子函数,确保挂载之前就有收到后端传来的信息:
mounted: function () {
var i=0,j=1; if(sessionStorage.getItem("login_user")!=null){ this.items.pop(); this.items1.pop(); var arr=new Array(); arr=sessionStorage.getItem("follow").split(','); j=(arr.length-1)/5; this.b=j; for(i=1;i<j+1;i++){ this.items1.push({ page:i, }) } //显示5个关注的人 for(i=0;i<arr.length-1&&i<5;i++){ this.items.push({ username:arr[i], }) } }else{ } },最后要实现页码效果:
html部分代码
<p id="follow_p" class="form-control" v-for="item in items">{{item.username}}<button id="follow_btn" class="btn btn-outline-success">取消关注</button>
</p>
l class="pagination pagination-sm" id="follow_pag"> <li class="page-item"> <a class="page-link" @click="turn_to_first" href="#">«</a> </li> <li class="page-item" v-for="(item,index) in items1" ref="menuItem"> <a class="page-link" @click="turn_to_page(index)" href="#">{{item.page}}</a> </li> <li class="page-item"> <a class="page-link" @click="turn_to_last" href="#">»</a> </li> ul>功能部分:
turn_to_first:function(){
this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.b=1; this.a=0; for(this.a=0;this.a<this.arr.length-1&&this.a<5;this.a++){ this.items.push({ username:this.arr[this.a], }) } }, turn_to_last:function(){ this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.b=Math.floor((this.arr.length-1)/5)+1; for(this.a=this.b*5-5;this.a<this.arr.length-1;this.a++){ this.items.push({ username:this.arr[this.a], }) } }, turn_to_page(index){ this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.items.pop(); this.b=this.$refs.menuItem[index].innerText for(this.a=this.b*5-5;this.a<this.b*5;this.a++){ if(this.arr[this.a]){ this.items.push({ username:this.arr[this.a], }) } } },
相关文章推荐
- 20180308.bulbBright后续改进:’关注和粉丝‘功能BUG修复
- 20180313.修复BUG:关注粉丝显示
- 软件缺陷数据能够告诉你什么? 今天,老大把我喊到办公室叮嘱我,“提测之后每天都要关注项目里的 bug,知道吧?” 我说,“我知道,我每天肯定会及时跟进 Open Bug 的修复进度和 Fixed
- OJ2.0userInfo页面Modify逻辑bug修复,search功能逻辑实现
- 实现类知乎android客户端关注和取消关注的按钮点击效果
- 使用Jquery分页插件jquery.pagination.js 实现无刷新分页效果
- ScrollView反弹效果实现[bug修正版]
- GenProg自动修复bug的实现
- 在Java中运用动态挂载实现 Bug 的热修复
- 大数据Spark “蘑菇云”行动第72课: 基于Spark 2.0.1项目实现之二. 实战 各种小bug修复及性能调优 200并行度调整为2个task
- 采用Jquery无刷新分页插件jquery.pagination.js 实现无刷新分页效果
- js实现下一页页码效果
- Redis Set 实现关注,粉丝功能
- Android 基于Proxy/Delegate 实现bug热修复
- Android 基于Proxy/Delegate 实现bug热修复
- 20180218.优化登录注册注销,数据库嵌套查询提取关注用户的名称,关注粉丝等功能BUG记录
- 三子棋的实现,完美篇终于修复了之前的BUG
- OJ2.0userInfo页面Modify逻辑bug修复,search功能逻辑实现
- 天天快报刷粉丝工具,天天快报刷关注助手,也可以刷评论或者阅读量。运行环境windows E语言实现
- 今日头条刷粉丝软件助手,刷关注有办法可以刷,只是慢了点,分享快速实现刷头条粉丝方法