File tree Expand file tree Collapse file tree 4 files changed +43
-9
lines changed
resources/js/components/widgets Expand file tree Collapse file tree 4 files changed +43
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "/app.js" : " /app.js?id=97408c65412f272ef297 " ,
2
+ "/app.js" : " /app.js?id=0ad42993485d05583c18 " ,
3
3
"/manifest.js" : " /manifest.js?id=8991394a854ee5cdffc3" ,
4
4
"/vendor.js" : " /vendor.js?id=8abff0e9c166b13b6b9e"
5
5
}
Original file line number Diff line number Diff line change @@ -108,18 +108,35 @@ export default {
108
108
break ;
109
109
}
110
110
},
111
- onRequest (uri ) {
111
+ onRequest (uri ) {
112
112
this .loading = true ;
113
- this .$http
114
- . get (uri)
115
- .then (res => {
113
+ this .beforeEmit ();
114
+ this . $http [ this . action . requestMethod ] (uri)
115
+ .then (( res ) => {
116
116
if (res .code == 200 ) {
117
+ this .successEmit ();
117
118
}
118
119
})
119
120
.finally (() => {
120
121
this .loading = false ;
122
+ this .afterEmit ();
121
123
});
122
- }
124
+ },
125
+ beforeEmit () {
126
+ this .action .beforeEmit .map ((item ) => {
127
+ this .$bus .emit (item .eventName , item .eventData );
128
+ });
129
+ },
130
+ afterEmit () {
131
+ this .action .afterEmit .map ((item ) => {
132
+ this .$bus .emit (item .eventName , item .eventData );
133
+ });
134
+ },
135
+ successEmit () {
136
+ this .action .successEmit .map ((item ) => {
137
+ this .$bus .emit (item .eventName , item .eventData );
138
+ });
139
+ },
123
140
},
124
141
computed: {
125
142
uri () {
Original file line number Diff line number Diff line change @@ -107,16 +107,33 @@ export default {
107
107
},
108
108
onRequest (uri ) {
109
109
this .loading = true ;
110
- this .$http
111
- . get (uri)
110
+ this .beforeEmit ();
111
+ this . $http [ this . attrs . requestMethod ] (uri)
112
112
.then ((res ) => {
113
113
if (res .code == 200 ) {
114
+ this .successEmit ();
114
115
}
115
116
})
116
117
.finally (() => {
117
118
this .loading = false ;
119
+ this .afterEmit ();
118
120
});
119
121
},
122
+ beforeEmit () {
123
+ this .attrs .beforeEmit .map ((item ) => {
124
+ this .$bus .emit (item .eventName , item .eventData );
125
+ });
126
+ },
127
+ afterEmit () {
128
+ this .attrs .afterEmit .map ((item ) => {
129
+ this .$bus .emit (item .eventName , item .eventData );
130
+ });
131
+ },
132
+ successEmit () {
133
+ this .attrs .successEmit .map ((item ) => {
134
+ this .$bus .emit (item .eventName , item .eventData );
135
+ });
136
+ },
120
137
},
121
138
};
122
139
</script >
You can’t perform that action at this time.
0 commit comments