iview-mpvue
  • 首页
  • 布局
    • Layout 栅格布局
    • Grid 宫格
    • Panel 面板
    • List 列表
    • Card 卡片
  • 基础组件
    • Button 按钮
    • Color 色彩
    • Icon 图标
  • 导航
    • TabBar 标签栏
    • Tabs 标签页
    • Drawer 抽屉
    • Page 分页
    • Steps 步骤条
    • NoticeBar 通告栏
    • Index 索引选择器
    • Sticky 吸顶容器
  • 操作反馈
    • ActionSheet 动作面板
    • Toast 轻提示
    • Modal 对话框
    • Message 全局提醒
    • Spin 加载中
    • Swipeout 滑动菜单
  • 视图
    • Badge 徽章
    • Alert 警告提示
    • Tag 标签
    • Progress 进度条
    • Avatar 头像
    • CountDown 倒计时
    • Divider 分隔符
    • Collapse 折叠面板
    • LoadMore 页底提示
  • 表单
    • Input 输入框
    • Radio 单选
    • Checkbox 复选
    • Switch 开关
    • Rate 评分
    • InputNumber 数字输入框
Powered by GitBook
On this page
  • 概述
  • 使用指南
  • 示例
  • API

Was this helpful?

  1. 导航

Page 分页

概述

当数据量较多时,使用分页可以快速进行数据切换

使用指南

在.vue中引入组件

<script>
    import iPage from 'iview-mpvue/dist/components/page/page'
    export default {
        components: {
            'i-page': iPage
        }
    }
</script>

示例

带有文字的按钮

<i-page :current="current" total="5" v-on:change="handleChange">
    <div slot="prev">Prev</div>
    <div slot="next">Next</div>
</i-page>

带有文字和图标的按钮

<i-page :current="current" total="5" v-on:change="handleChange">
    <div slot="prev">
        <i-icon type="return"></i-icon>
        上一步
    </div>
    <div slot="next">
        下一步
        <i-icon type="enter"></i-icon>
    </div>
</i-page>

隐藏数字

<i-page :current="current" total="5" :simple="true" v-on:change="handleChange">
    <div slot="prev">Prev</div>
    <div slot="next">Next</div>
</i-page>

只显示数字

<i-page :current="current" total="5" mode="number" v-on:change="handleChange"></i-page>

显示点

<i-page :current="current" total="5" mode="pointer" v-on:change="handleChange"></i-page>
<script>
    export default {
        ...
        data() {
            return {
                current: 1
            }
        },
        methods: {
            handleChange (detail) {
                const type = detail.type;
                if (type === 'next') {
                    this.current = this.current + 1
                } else if (type === 'prev') {
                    this.current = this.current - 1
                }
            }
        }
    }
</script>

API

Panel properties

属性

说明

类型

默认值

i-class

自定义 class 类名

String

-

mode

类型,可选值为 button、number、pointer

String

button

current

当前页码

Number

1

total

总页数

Number

0

simple

是否隐藏数值

Boolean

false

Page events

事件名

说明

返回值

v-on:change

切换页码时触发,返回 prev 或 next

{ type }

PreviousDrawer 抽屉NextSteps 步骤条

Last updated 5 years ago

Was this helpful?