Skip to content

Commit 748d75e

Browse files
committed
docs: properly register the composition API plugin
1 parent 5c05ef3 commit 748d75e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/composition-api.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ sidebarDepth: 3
77

88
In addition to the Renderless Components and the Mixins, Feathers-Vuex includes utilities that let you take advantage of the [Vue Composition API](https://github.com/vuejs/composition-api).
99

10+
It's important to note that the `@vue/composition-api` plugin must be registered BEFORE you import `App.vue`. This means that you need to modify your `main.js` file to look like this:
11+
12+
```js
13+
import Vue from 'vue'
14+
import VueCompositionApi from '@vue/composition-api'
15+
16+
// Register the Composition API plugin BEFORE you import App.vue
17+
Vue.use(VueCompositionApi)
18+
19+
import App from './App.vue'
20+
import router from './router'
21+
import store from './store/store'
22+
import './plugins/plugins'
23+
Vue.config.productionTip = true
24+
new Vue({
25+
router,
26+
store,
27+
render: h => h(App)
28+
}).$mount('#app')
29+
```
30+
31+
If you forget to register the plugin, first, you will see a console warning from Vue stating `[Vue warn]: Error in data(): "Error: [vue-composition-api] must call Vue.use(plugin) before using any function.". To fix this, make sure to register the plugin BEFORE you call any Composition utility functions, as shown above.
32+
1033
## Setup
1134

1235
Before you can use the `useFind` and `useGet` composition functions, you'll need to [install the Vue Composition API](https://github.com/vuejs/composition-api#Installation) plugin.

0 commit comments

Comments
 (0)