Action event on loaded component Async
See original GitHub issueWhat problem does this feature solve?
Reference: https://vuejs.org/v2/guide/components-dynamic-async.html#Handling-Loading-State
Current Issue: We do not know when the async component was loaded, with this, the ‘Ref’ is also not recognized in the ‘mounted()’ father
What does the proposed API look like?
Feature Request: Prop from ‘created’ in asynchronous component to go event
const AsyncComponent = () => ({
// The component to load (should be a Promise)
component: import('./MyComponent.vue'),
// A component to use while the async component is loading
loading: LoadingComponent,
// A component to use if the load fails
error: ErrorComponent,
// Delay before showing the loading component. Default: 200ms.
delay: 200,
// The error component will be displayed if a timeout is
// provided and exceeded. Default: Infinity.
timeout: 3000,
created: () => something()
})
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How To Handle Async Data Loading, Lazy Loading, and Code ...
In this step, you asynchronously loaded components. You used lazy and Suspense to dynamically import components and to show a loading message ...
Read more >Set loading state before and after an action in a React class ...
8. I took it a step further and did const asyncSetState = instance => newState => new Promise(resolve => instance.setState(newState, resolve)); which you...
Read more >Components With Async Friendly Event Handlers - Vatsal's Blog
These actions can be asynchronous in nature and it's in these cases where having async event handlers is quite beneficial.
Read more >Redux Fundamentals, Part 6: Async Logic and Data Fetching
Just like with a normal action, we first need to handle a user event in the application, such as a click on a...
Read more >Performing Async Actions using Hooks | by Gasim Gasimzada
We should set up interface/contract that all parts of the abstracted idea agree upon. Using hooks to build async action functionality. Hooks ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found a cleaner way to do this (without modify child component):
You can add a listener on the child component:
Then in the child’s
mounted
hook dothis.$emit('ready')