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 },
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通