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 {
6969 name: ' Spinner' ,
7070 computed: {
7171 spinnerView () {
72- const spinner = this .$attrs .spinner || config .props .spinner ;
73-
7472 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
7876 );
7977 },
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+ },
8099 },
81100};
82101 </script >
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const slots = {
3636 noMore : 'No more data :)' ,
3737 error : 'Opps, something went wrong :(' ,
3838 errorBtnText : 'Retry' ,
39+ spinner : '' ,
3940} ;
4041
4142/**
You can’t perform that action at this time.
0 commit comments