A. Plugin must be installed before mounting the app
B. app.use() requires a second argument
C. Vue.createApp() is missing parentheses
D. app.mount() should be called twice
Solution
Step 1: Check plugin installation order
Plugins must be installed before calling app.mount() to ensure plugin features are available.
Step 2: Analyze given code
The code mounts the app first, then installs the plugin, which is too late.
Final Answer:
Plugin must be installed before mounting the app -> Option A
Quick Check:
Install plugins before mount = B [OK]
Hint: Always call app.use() before app.mount() [OK]
Common Mistakes:
Installing plugins after mounting
Thinking app.use() always needs options
Confusing createApp syntax
5. You want to create a plugin that globally registers a component MyButton and adds a global method $log to log messages. Which is the correct way to write the plugin's install method?
Use app.component() to register components and app.config.globalProperties to add global methods.
Step 2: Check each option
install(app) { app.component('MyButton', MyButton); app.config.globalProperties.$log = msg => console.log(msg); } uses correct methods and property names. Options A, B, and D use outdated or incorrect APIs.