1
1
<template >
2
- <a-list size =" large" class =" list" :loading =" loading" >
2
+ <a-list size =" large" class =" list" :loading =" loading || tabLoading " >
3
3
<a-list-item :key =" index" v-for =" (item, index) in items" class =" item" >
4
4
<a-list-item-meta >
5
5
<span slot =" title" style =" word-break : break-all " ><strong >{{ item.name }}</strong ></span >
15
15
@keydown.esc =" editableValueKey = null"
16
16
@pressEnter =" updateData(item)" >
17
17
</a-input >
18
- <span v-else class =" value" >
18
+ <span v-else class =" value" @click = " setEditableSetting(item, index) " >
19
19
{{ item.value }}
20
20
</span >
21
21
</div >
@@ -64,7 +64,8 @@ export default {
64
64
items: [],
65
65
scopeKey: ' ' ,
66
66
editableValueKey: null ,
67
- editableValue: ' '
67
+ editableValue: ' ' ,
68
+ tabLoading: false
68
69
}
69
70
},
70
71
beforeMount () {
@@ -95,14 +96,15 @@ export default {
95
96
this .fetchData ()
96
97
},
97
98
watch: {
98
- resource : newItem => {
99
+ resource : function ( newItem , oldItem ) {
99
100
if (! newItem .id ) return
101
+ this .resource = newItem
100
102
this .fetchData ()
101
103
}
102
104
},
103
105
methods: {
104
106
fetchData (callback ) {
105
- this .loading = true
107
+ this .tabLoading = true
106
108
api (' listConfigurations' , {
107
109
[this .scopeKey ]: this .resource .id ,
108
110
listAll: true
@@ -112,13 +114,13 @@ export default {
112
114
console .error (error)
113
115
this .$message .error (' There was an error loading these settings.' )
114
116
}).finally (() => {
115
- this .loading = false
117
+ this .tabLoading = false
116
118
if (! callback) return
117
119
callback ()
118
120
})
119
121
},
120
122
updateData (item ) {
121
- this .loading = true
123
+ this .tabLoading = true
122
124
api (' updateConfiguration' , {
123
125
[this .scopeKey ]: this .resource .id ,
124
126
name: item .name ,
@@ -133,7 +135,7 @@ export default {
133
135
description: ' There was an error saving this setting. Please try again later.'
134
136
})
135
137
}).finally (() => {
136
- this .loading = false
138
+ this .tabLoading = false
137
139
this .fetchData (() => {
138
140
this .editableValueKey = null
139
141
})
0 commit comments