Skip to content

apijson-viewedit: add loading spin #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"hook_init", //hook_init(vm), will invoke in mounted()
"hook_ajax_params", //hook_ajax_params(method,action,params), will invoke before ajax action
"hook_add", //hook_add(vm), customize the add action
"hook_viewedit" //hook_viewedit(vm), customize the add action
"hook_viewedit" //hook_viewedit(vm, params), customize the view edit action
],
template: `<div>
<div v-if="config_editable && config_add_fields!=null"><i-button type="primary" @click="add">Add</i-button> <br><br> </div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"hook_init",
"hook_ajax_params"
],
template: `
template: `<div>
<Spin size="large" fix v-if="loading"></Spin>
<i-form @submit.native.prevent :label-width="80">
<form-item v-for="item in viewedit_items" :key="item.key" :label="item.title">
<i-input v-if="item.component=='input'" v-model="item.value" :readonly="!editable(item)"></i-input>
Expand All @@ -21,11 +22,12 @@
<i-button type="info" icon="ios-download" size="large" @click="save">Save</i-button>
</form-item>
</i-form>
`,
</div>`,
data: function(){
return {
l_request_tag: null,
role: "{{=role or ''}}",
loading: false,
row: {},
row_saved: {},
viewedit_items: [],
Expand All @@ -36,6 +38,7 @@
},
methods: {
init_viewedit: function(){
this.loading = true
var params = {}
var model_params = {
"id":this.id
Expand All @@ -51,6 +54,7 @@
contentType: 'application/json',
data: JSON.stringify(params),
success: function (data) {
thisp.loading = false
if (data.code==200) {
thisp.row = data[thisp.model_name]
thisp.row_saved = thisp.row
Expand Down