Skip to content

Commit bbe0002

Browse files
author
Luis Saraza
authored
docs: Update Setting Globally at Registration Docs to Vue3 (#1693)
1 parent 9e1e712 commit bbe0002

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/guide/components.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default {
6161
If you want all instances of Vue Select to use your custom components throughout your app, while
6262
only having to set the implementation once, you can do so when registering Vue Select as a component.
6363

64+
## Vue 2x
6465
```js
6566
import Vue from 'vue';
6667
import vSelect from 'vue-select';
@@ -79,5 +80,25 @@ vSelect.props.components.default = () => ({
7980
Vue.component(vSelect)
8081
```
8182

83+
## Vue 3x
84+
```js
85+
import {createApp, h} from 'vue';
86+
import vSelect from 'vue-select';
87+
88+
// Set the components prop default to return our fresh components
89+
vSelect.props.components.default = () => ({
90+
Deselect: {
91+
render: () => h('span', ''),
92+
},
93+
OpenIndicator: {
94+
render: () => h('span', '🔽'),
95+
},
96+
});
97+
98+
// Register the component
99+
const app = createApp(App);
100+
app.component('vSelect', vSelect);
101+
```
102+
82103
<CustomComponentRegistration />
83104

0 commit comments

Comments
 (0)