A. Async component must be registered globally, not locally
B. The template uses instead of self-closing
C. Missing Suspense wrapper to handle loading state
D. The import path './MyComp.vue' is invalid syntax
Solution
Step 1: Check async component usage rules
Async components should be wrapped in <Suspense> to show fallback during loading.
Step 2: Analyze the given code
The code lacks a <Suspense> wrapper, so no loading state is handled.
Final Answer:
Missing Suspense wrapper to handle loading state -> Option C
Quick Check:
Async components need Suspense for loading fallback [OK]
Hint: Always wrap async components in Suspense for loading UI [OK]
Common Mistakes:
Thinking self-closing tags are mandatory
Believing async components must be global
Assuming import path syntax is wrong
5. You want to lazy load two components, CompA and CompB, but only show CompB after CompA finishes loading. How can you achieve this using Vue async components and Suspense?
hard
A. Wrap CompA in Suspense, and inside its default slot, include CompB as a normal component
B. Use defineAsyncComponent for both, wrap both in a single Suspense, and use v-if to show CompB only after CompA loads
C. Load both components with defineAsyncComponent and render them side by side without Suspense
D. Wrap CompA in a Suspense with fallback, then in CompA's mounted hook, render CompB inside another Suspense
Solution
Step 1: Understand the loading order requirement
You want CompB to appear only after CompA finishes loading.
Step 2: Use sequential triggering with lifecycle
Wrap CompA in Suspense; in CompA's mounted hook, dynamically render CompB (async) inside its own Suspense for true sequential loading.
Step 3: Why other options fail
Wrapping both in a single Suspense loads them in parallel (shows both after slowest finishes); loading side-by-side without Suspense skips fallback and loads parallel; including normal CompB in CompA's default slot loads it immediately upon CompA resolution.
Final Answer:
Wrap CompA in a Suspense with fallback, then in CompA's mounted hook, render CompB inside another Suspense -> Option D
Quick Check:
Sequential async = trigger next in mounted [OK]
Hint: Trigger next async component in mounted hook for sequential loading [OK]
Common Mistakes:
Using single Suspense for parallel loading
Skipping Suspense for async components
Treating second component as normal (non-async)
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.