File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,33 @@ export default {
69
69
name: ' Spinner' ,
70
70
computed: {
71
71
spinnerView () {
72
- const spinner = this .$attrs .spinner || config .props .spinner ;
73
-
74
72
return (
75
- typeof spinner === ' string'
76
- ? ( SPINNERS [spinner .toUpperCase ()] || SPINNERS . DEFAULT )
77
- : spinner
73
+ typeof this . $attrs . spinner === ' string'
74
+ ? SPINNERS [this . $attrs . spinner .toUpperCase ()]
75
+ : this . spinnerInConfig // fallback to spinner of config
78
76
);
79
77
},
78
+ spinnerInConfig () {
79
+ let result;
80
+
81
+ if (config .slots .spinner && typeof config .slots .spinner === ' string' ) {
82
+ // as spinner slot config a pure text spinner
83
+ result = {
84
+ render () {
85
+ return this ._v (config .slots .spinner ); // eslint-disable-line no-underscore-dangle
86
+ },
87
+ };
88
+ } else if (typeof config .slots .spinner === ' object' ) {
89
+ // as spinner slot config a Vue component
90
+ result = config .slots .spinner ;
91
+ } else {
92
+ // fallback to spinner property config
93
+ /* istanbul ignore next */
94
+ result = SPINNERS [config .props .spinner .toUpperCase ()] || SPINNERS .DEFAULT ;
95
+ }
96
+
97
+ return result;
98
+ },
80
99
},
81
100
};
82
101
</script >
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const slots = {
36
36
noMore : 'No more data :)' ,
37
37
error : 'Opps, something went wrong :(' ,
38
38
errorBtnText : 'Retry' ,
39
+ spinner : '' ,
39
40
} ;
40
41
41
42
/**
You can’t perform that action at this time.
0 commit comments