2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00

docs: Update Setting Globally at Registration Docs to Vue3 (#1693)

This commit is contained in:
Luis Saraza
2022-11-08 13:05:07 -05:00
committed by GitHub
parent 9e1e7125fa
commit bbe0002f86
+21
View File
@@ -61,6 +61,7 @@ export default {
If you want all instances of Vue Select to use your custom components throughout your app, while
only having to set the implementation once, you can do so when registering Vue Select as a component.
## Vue 2x
```js
import Vue from 'vue';
import vSelect from 'vue-select';
@@ -79,5 +80,25 @@ vSelect.props.components.default = () => ({
Vue.component(vSelect)
```
## Vue 3x
```js
import {createApp, h} from 'vue';
import vSelect from 'vue-select';
// Set the components prop default to return our fresh components
vSelect.props.components.default = () => ({
Deselect: {
render: () => h('span', '❌'),
},
OpenIndicator: {
render: () => h('span', '🔽'),
},
});
// Register the component
const app = createApp(App);
app.component('vSelect', vSelect);
```
<CustomComponentRegistration />