在vueJs中使用过滤器进行分页

时间:2016-03-16 04:19:36

标签: jquery pagination vue.js vue-resource

我找到了代码in here

            $imagename = $this->person->view($this->input->post('id'))->image;
     if(file_exists("images/$imagename")) unlink("images/".$imagename);
     $fileName = time(). '_' .$_FILES["image"]["name"];
        move_uploaded_file($_FILES["image"]["tmp_name"],$output_dir.$fileName); //this line
$targetPath = 'images/' . $fileName;
    $config_resize['image_library'] = 'gd2';
     $config_resize['create_thumb'] = FALSE;
     $config_resize['maintain_ratio'] = TRUE;
  //   $config_resize['master_dim'] = 'height';
     $config_resize['quality'] = "80%";
     $config_resize['source_image'] = $targetPath;
     $config_resize['height'] = 600;
     $config_resize['width'] = 1024;
  //   $config_resize['thumb_marker'] = '';
     $config_resize['new_image'] = 'images/' . $fileName;
     $this->image_lib->initialize($config_resize);
     $this->image_lib->resize();

     $uploaded = TRUE;

但是我发现错误,当我点击最后一页&我在第一页中发现,他是错误的。

例如:我在分页和点击中点击了第9页我发现" Kathy"。在分页显示-3,-2-1,0&没什么结果,

我如何找到" Kathy"当最后一页的条件" 9"

1 个答案:

答案 0 :(得分:0)

这是因为你的物品已经改变了;在这种情况下,变得更少。

您应该关注项目更改,并调用更新方法重置活动页面参数,以便我们可以跳回到第一页。

在您的分页组件中添加以下代码,它应该可以解决问题:

        watch: {
            'items': function(){
                this.update(0);
            }
        },