-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Global defaults for pending and error #8
Comments
👍 Yup, this would be very useful! |
This comment has been minimized.
This comment has been minimized.
It's similar, except I was thinking about hoisting the Catch and Error component with some conventions in the lib file and use them as fallbacks. Passing a prop for the component also looks like a good thing as it is possible to have different kind of errors or loading components but at the same time I feel like duplicating the API for a ver small syntax gain that is chained to a convention on the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hey man, I've used your package for a long time now (it's great) and the way I do it now is wrapping vue promised inside my own component which has a default loader (but can be changed by a prop) and a default error state. I have some thoughts on making this easier being a package though, how about you make a plugin out of it instead of a component, that way you can pass options and do something like this: import { Promised } from 'vue-promised';
import LoadingComponent from '';
import ErrorComponent from '';
Vue.use(Promised, {
id: 'vue-promised', // Promised by default?
defaults: {
pending: LoadingComponent,
catch: ErrorComponent,
},
}); The plugin registers the component, the LoadingComponent and ErrorComponent both receive the slot-scope as props. |
Hello, I'm glad you like it. It won't be a plugin, I want to keep the flexibility of a component. The registration will probably be done through an exported function or by setting a property in the component option object |
@posva Alright, well I wouldn't really know how to abstract away the complexities of that, but I'm keen to see how you'll solve it :). Good luck, looking forward to your solution! |
In big applications, it is very common to use similar if not the same pending and error handler. This would prevent a lot of boilerplate from users
The text was updated successfully, but these errors were encountered: