avue-搜索解析

getList方法,需要传param(初始为空)和分页

复制代码
 getList() {
            this.showLoading = true;
            const data = Object.assign({
                pageNum: this.page.currentPage,
                pageSize: this.page.pageSize,
            }, this.params)
            getQuotationList(data).then(res => {
                this.showLoading = false;
                this.data = res.data.quotationList;
                this.page.total = res.data.count;
            });
        },
复制代码

需要在mounted里用一下

mounted() {
        this.getList();
    },

然后搜索,时,给参数param赋值,还需要传入done参数

复制代码
  <avue-crud :data="data" :option="option" v-model="form" :page.sync="page" @current-change="currentChange" @size-change="sizeChange" @search-reset="searchChange" @search-change="searchChange"
                       :before-open="beforeOpen" @row-save="saverow" @row-del="del" @row-update="saveOrder">
                <!--                自定义操作按钮-->
                <template slot="menu" slot-scope="{type,size,row}">
                    <el-button icon="el-icon-check" :size="size" :type="type" @click="shenpi(row)">审批</el-button>
                    <el-button icon="el-icon-close" :size="size" :type="type" @click="qishen(row)">弃审</el-button>
                </template>

                <template slot="infoForm" slot-scope="scope" >
                    <avue-crud :option="infoOption" :data="infoData" @row-update="rowupdate" @row-save="saveOrder2">
                    </avue-crud>
                </template>
            </avue-crud>
复制代码

调用

 searchChange(params, done) {
            if (done) done();
            this.params = params;
            this.page.currentPage = 1;
            this.getList();
            this.$message.success('搜索成功')
        },

分页搜索

复制代码
   sizeChange(val) {
        this.page.currentPage = 1
        this.page.pageSize = val
        this.getList()
        this.$message.success('行数' + val)
      },
      currentChange(val) {
        this.page.currentPage = val
        this.getList()
        this.$message.success('页码' + val)
      }
复制代码

 最后附上page

复制代码
page: {
                total: 0,
                currentPage: 1,
                pageSize: 10
            },
View Code
复制代码

 

posted @   820820820  阅读(837)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示