Skip to content

Commit d275e12

Browse files
committed
apijson-viewedit: add loading spin
1 parent f68aa14 commit d275e12

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

uliweb_apijson/apijson/templates/vue/inc_apijson_table.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"hook_init", //hook_init(vm), will invoke in mounted()
1010
"hook_ajax_params", //hook_ajax_params(method,action,params), will invoke before ajax action
1111
"hook_add", //hook_add(vm), customize the add action
12-
"hook_viewedit" //hook_viewedit(vm), customize the add action
12+
"hook_viewedit" //hook_viewedit(vm, params), customize the view edit action
1313
],
1414
template: `<div>
1515
<div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>

uliweb_apijson/apijson/templates/vue/inc_apijson_viewedit.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"hook_init",
1010
"hook_ajax_params"
1111
],
12-
template: `
12+
template: `<div>
13+
<Spin size="large" fix v-if="loading"></Spin>
1314
<i-form @submit.native.prevent :label-width="80">
1415
<form-item v-for="item in viewedit_items" :key="item.key" :label="item.title">
1516
<i-input v-if="item.component=='input'" v-model="item.value" :readonly="!editable(item)"></i-input>
@@ -21,11 +22,12 @@
2122
<i-button type="info" icon="ios-download" size="large" @click="save">Save</i-button>
2223
</form-item>
2324
</i-form>
24-
`,
25+
</div>`,
2526
data: function(){
2627
return {
2728
l_request_tag: null,
2829
role: "{{=role or ''}}",
30+
loading: false,
2931
row: {},
3032
row_saved: {},
3133
viewedit_items: [],
@@ -36,6 +38,7 @@
3638
},
3739
methods: {
3840
init_viewedit: function(){
41+
this.loading = true
3942
var params = {}
4043
var model_params = {
4144
"id":this.id
@@ -51,6 +54,7 @@
5154
contentType: 'application/json',
5255
data: JSON.stringify(params),
5356
success: function (data) {
57+
thisp.loading = false
5458
if (data.code==200) {
5559
thisp.row = data[thisp.model_name]
5660
thisp.row_saved = thisp.row

0 commit comments

Comments
 (0)