wuruoyun/vue-component-lib-starter

Is it possible to use this starter with vue-router?

Closed this issue · 0 comments

Is it possible to use vue-router in this starter? Please check my index.ts below.

import { App } from "vue";
import { router } from "./router/index";
import { pinia } from "./stores";
import Notifications from "notiwind";
import * as components from "./components";
import * as pages from "./pages";

function install(app: App) {
    app.use(router);
    app.use(pinia);
    app.use(Notifications);

    for (const key in components) {
        // @ts-expect-error
        app.component(key, components[key]);
    }
    for (const key in pages) {
        app.component(key, pages);
    }
}

import "./assets/main.css";

export default { install };

export * from "./router";
export * from "./components";
export * from "./pages";
export * from "./utils";
export * from "./stores";

I'm getting a warning: [Vue warn]: injection "Symbol(router)" not found.

When I use useRouter, I'm getting this error: TypeError: Cannot read properties of undefined (reading 'push')