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 },

浙公网安备 33010602011771号