Comments (6)
Start a new pull request in StackBlitz Codeflow.
from nuxt.
@xuzhihui123 composables are runtime only, if you want to use a composable in plugin you have to make sure it's running on client side only. you can achive that by adding .client
to your plugin name (test.client.ts
) or wapping it around onNuxtReady
onNuxtReady(async () => {
await a();
})
from nuxt.
thanks, Is there any other way to run it on the server side?
from nuxt.
Because I want to set some values after requesting some data from the server, which happens in server-side rendering, not just client-side rendering
from nuxt.
Hello, you need to set the nuxt context with nuxtApp.runWithContext
. useState
is a composable that requires the nuxt context to be accessible
see https://nuxt.com/docs/guide/going-further/nuxt-app#the-nuxt-context
from nuxt.
ok, solved it,thanks
from nuxt.
Related Issues (20)
- Massive amount of warnings with PrimeVue HOT 2
- nuxt 3.12 useState change detection fails when ssr is false HOT 2
- type error in `nuxt.config.ts` for app.head.link[] - definition for link not comaptible HOT 1
- useAsyncData's return type for data and error still is `| null` in v4 HOT 1
- The way dynamic route path is generated breaks usage with path-to-regexp HOT 5
- 'builder:watch' hook isn't released when nuxt.config is updated HOT 1
- WebSockets for dev server not respecting HTTPS HOT 1
- The route I customized in pages:extend cannot load the custom layout. HOT 4
- useState lost reactivity on `ssr: false` HOT 2
- `definePageMeta` breaks definition/compilation of inline JSX-components HOT 2
- `selectiveClient: 'deep'` with unocss breaks components with scoped styles and `<slot />` during 'build'
- Middleware ( in definePageMeta ) isn't called in Option API components in Nuxt v3.12.1 HOT 2
- Error: Cannot find module '@nuxt/ui-templates'
- @bg-dev/nuxt-directus not working with Nuxt 3.12.2
- Nuxt 4 - defineNuxtModule using nuxt.dir.public resolve to absolute path HOT 7
- Error: Cannot find module '@nuxt/ui-templates' HOT 2
- Build size increase 7x after upgrading nuxt from 3.5.3 to 3.11.2 HOT 3
- useAsyncData unexpected behaviour when callback return falsy value HOT 5
- `nuxt-nightly` installs `nuxt` and `nitro` with `npm i`
- Type error in nuxt.config.ts for valid app.head.link[].type HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.