3

background

Sometimes you want to add some patch functions or modification functions to some component libraries of Vue. If these libraries have APIs exposed to the global like ElementUI, they are also easy to be tampered with at runtime. If they are not exposed to the global but registered as global components, But you don't want to go to the source code of the library, what to do? In fact, we can dynamically tamper with or add some functions at runtime. At this time, we need to access the configuration objects of these components

Vue2.x version

in Vue.options.components

Vue 3.X version

In Vue.createApp _context.components the object returned by this api
 // 例如
Vue.createApp({})._context.components

而井
851 声望1.8k 粉丝