Skip to content

Commit 2ab1138

Browse files
committed
add Spin when loading; fix wrong current_page when page size change
1 parent 41da60e commit 2ab1138

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

uliweb_apijson/apijson/templates/vue/inc_apijson_table.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
props: ["table_name","config","func_init","func_change_params"],
55
template: `<div>
66
<div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>
7+
<Spin size="large" fix v-if="loading"></Spin>
78
<i-table stripe border :columns="tcolumns" :data="tlist" @on-sort-change="table_on_sort_change"></i-table>
89
<page :total="total" :page-size="query_count" :current.sync="current_page" :page-size-opts="[10, 20, 50, 100]" show-sizer @on-change="page_on_change" @on-page-size-change="page_on_page_size_change"></page>
910
<modal v-model="modal_add" title="Add">
@@ -37,6 +38,7 @@
3738
data: function(){
3839
var thisp = this
3940
return {
41+
loading: false,
4042
modal_view: false,
4143
viewedit_items: [],
4244

@@ -125,12 +127,14 @@
125127
if (thisp.func_change_params!=null) {
126128
params = thisp.func_change_params("apijson_get",params)
127129
}
130+
thisp.loading = true
128131
$.ajax({
129132
type: "POST",
130133
url: "{{=url_for('uliweb_apijson.apijson.views.ApiJson.get')}}",
131134
contentType: 'application/json',
132135
data: JSON.stringify(params),
133136
success: function (data) {
137+
thisp.loading = false
134138
if (data.code==200) {
135139
var arr = data["[]"]
136140
if (!thisp.tcolumns_init) {
@@ -340,7 +344,7 @@
340344
},
341345
page_on_page_size_change: function(data) {
342346
this.query_count = data
343-
this.current_page = 0
347+
this.current_page = 1
344348
this.update_list()
345349
}
346350
},

0 commit comments

Comments
 (0)