vuejs3

How to provide/inject into Vue root instance WITH nuxt and @vue/composition-api?

北战南征 提交于 2020-08-10 04:46:34
问题 I'm trying to use @vue/apollo-composable with my Nuxt-Ts application. This is the example how it should be injected into root instance on a "normal" Vue application: import { provide } from '@vue/composition-api' import { DefaultApolloClient } from '@vue/apollo-composable' const app = new Vue({ setup () { provide(DefaultApolloClient, apolloClient) }, render: h => h(App), }) Problem: I don't know how to get access to the root instance in Nuxt-TS . I tried making a plugin, but it's injected

How to provide/inject into Vue root instance WITH nuxt and @vue/composition-api?

拥有回忆 提交于 2020-08-10 04:46:23
问题 I'm trying to use @vue/apollo-composable with my Nuxt-Ts application. This is the example how it should be injected into root instance on a "normal" Vue application: import { provide } from '@vue/composition-api' import { DefaultApolloClient } from '@vue/apollo-composable' const app = new Vue({ setup () { provide(DefaultApolloClient, apolloClient) }, render: h => h(App), }) Problem: I don't know how to get access to the root instance in Nuxt-TS . I tried making a plugin, but it's injected

How to properly reset Vue Composition Api's reactive values

大憨熊 提交于 2020-08-08 04:23:11
问题 I'm wondering how should I reset a reactive in vuejs setup? (i know if change it to the ref and using view.value will solve this problem, but there should be an answer to this for using reactive) 回答1: You can use Object.assign : setup() { const initialState = { name: "", lastName: "", email: "" }; const form = reactive({ ...initialState }); function resetForm() { Object.assign(form, initialState); } function setForm() { Object.assign(form, { name: "John", lastName: "Doe", email: "john@doe.com

Uncaught Error: [vue-composition-api] must call Vue.use(plugin) before using any function

和自甴很熟 提交于 2020-06-16 04:07:57
问题 Consider the following composition function: import { computed, ref } from '@vue/composition-api' import { isInternetExplorer } from 'src/services/utils/utilsService' import { Screen } from 'quasar' import { auth, getAllScopes } from 'src/services/auth/authService' const isLoginPopup = Screen.lt.sm || isInternetExplorer ? false : true const accountID = ref('') export const setAccountID = () => { const account = auth.getAccount() if (account) { accountID.value = account.idTokenClaims.oid }