scTableSelect add params

This commit is contained in:
sc 2021-10-08 09:09:31 +08:00
parent 17b75dcd5a
commit 22d98bfee9
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@
props: { props: {
modelValue: null, modelValue: null,
apiObj: { type: Object, default: () => {} }, apiObj: { type: Object, default: () => {} },
params: { type: Object, default: () => {} },
placeholder: { type: String, default: "请选择" }, placeholder: { type: String, default: "请选择" },
multiple: { type: Boolean, default: false }, multiple: { type: Boolean, default: false },
disabled: { type: Boolean, default: false }, disabled: { type: Boolean, default: false },
@ -93,6 +94,7 @@
[this.defaultProps.pageSize]: this.pageSize, [this.defaultProps.pageSize]: this.pageSize,
[this.defaultProps.keyword]: this.keyword [this.defaultProps.keyword]: this.keyword
} }
Object.assign(reqData, this.params)
var res = await this.apiObj.get(reqData); var res = await this.apiObj.get(reqData);
var parseData = config.parseData(res) var parseData = config.parseData(res)
this.tableData = parseData.rows; this.tableData = parseData.rows;

View File

@ -11,7 +11,7 @@
<el-main> <el-main>
<el-alert title="select深度改造的表格选择器, 非常适用于大量数据选择的场景" type="success" style="margin-bottom:20px;"></el-alert> <el-alert title="select深度改造的表格选择器, 非常适用于大量数据选择的场景" type="success" style="margin-bottom:20px;"></el-alert>
<el-card shadow="never" header="单选"> <el-card shadow="never" header="单选">
<sc-table-select v-model="value2" :apiObj="apiObj" :table-width="600" :props="props"> <sc-table-select v-model="value2" :apiObj="apiObj" :params="params" :table-width="600" :props="props">
<el-table-column prop="id" label="ID" width="150"></el-table-column> <el-table-column prop="id" label="ID" width="150"></el-table-column>
<el-table-column prop="user" label="姓名"></el-table-column> <el-table-column prop="user" label="姓名"></el-table-column>
</sc-table-select> </sc-table-select>
@ -32,6 +32,9 @@
data() { data() {
return { return {
apiObj: this.$API.demo.page, apiObj: this.$API.demo.page,
params: {
name: 'demoName'
},
value: [ value: [
{ {
id: "410000199512025445", id: "410000199512025445",