Skip to content

Please add an example for pinia in the docs #5003

@paulrosen

Description

@paulrosen

Is your feature request related to a problem? Please describe.

I spent a few hours trying to figure out how to add pinia - I searched the docs, I tried some things, I looked at the pinia docs. I even tried the AI chat bot in this page, which sent me around in circles with bad advice. Anyway, I found the solution in these issues but wish it were more obvious

Describe the solution you'd like

In the docs, have:

to install pinia when using the default vitepress theme, add the following file:

// .vitepress/theme/index.ts

import { EnhanceAppContext } from "vitepress";
import DefaultTheme from "vitepress/theme";

import { createPinia } from "pinia";

export default {
  ...DefaultTheme,
  enhanceApp(ctx: EnhanceAppContext) {
    DefaultTheme.enhanceApp(ctx);

    const pinia = createPinia();
    ctx.app.use(pinia);
  },
};

Describe alternatives you've considered

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions