@leanjs/vue-router
TypeScript icon, indicating that this package has built-in type declarations

0.7.8 • Public • Published

@leanjs/vue-router

Installation

If your Vue Router app is in a monorepo (recommended) execute the following command at the root of your repository:

yarn add -W @leanjs/vue-router @leanjs/core vue-router@4 vue@3

then in the package.json of your Vue Router app add the following peerDependencies:

"peerDependencies": {
  "@leanjs/core": "*",
  "@leanjs/vue-router": "*",
  "vue-router": "*",
  "vue": "*"
}

If your Vue Router app is not in a monorepo, then run the following command instead of the above:

yarn add @leanjs/vue-router @leanjs/core vue-router@4 vue@3

Composable app

Create small Vue Router apps that can be composed with other apps.

createApp

Arguments:

  • App: Component - required
  • options: { appName: string } - required. You have to specify the name of your composable app.

Create a file called index.ts|js in the src directory where your composable app is.

my-monorepo/
├─ apps/
├─ composable-apps/
│  ├─ vue-router-app-1/
│  │  ├─ package.json
│  │  ├─ src/
│  │  │  ├─ VueRouterApp1.vue
│  │  │  ├─ index.ts 👈
├─ package.json

:::info

Read the recommended setup in our getting started page if you want to create a similar monorepo structure

:::

Call createApp with the root component of your Vue Router app:

import { createApp } from "@leanjs/vue-router";

import VueRouterApp1 from "./VueRouterApp1.vue";

// 👇  you have to `export default createApp(`
export default createApp(VueApp, {
  appName: "VueRouterApp1",
});

Hello world example of the VueRouterApp1 imported above

<!-- my-monorepo/composable-apps/vue-router-app-1/src/VueRouterApp1.tsx -->

<template>
  <h1>Hello composable Vue Router app</h1>
</template>

Create a file called selfHosted.ts|js in the src directory where your composable app is, for example:

my-monorepo/
├─ apps/
├─ composable-apps/
│  ├─ vue-router-app-1/
│  │  ├─ package.json
│  │  ├─ src/
│  │  │  ├─ VueRouterApp1.vue
│  │  │  ├─ index.ts
│  │  │  ├─ selfHosted.ts 👈
├─ package.json

Export a createRuntime function from the selfHosted.ts|js file. This is the runtime that will be used when the app runs in isolation, meaning without a host.

// my-monorepo/composable-apps/vue-router-app-1/src/selfHosted.ts

export { createRuntime } from "@my-org/runtime-react";

:::info

Read @leanjs/core if you have not already created your own createRuntime function

:::

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.7.88latest

Version History

VersionDownloads (Last 7 Days)Published
0.7.88
0.7.70
0.7.60
0.7.50
0.7.40
0.7.32
0.7.21
0.7.11
0.7.01
0.6.71
0.6.60
0.6.50
0.6.41
0.6.30
0.6.20
0.6.10
0.6.00
0.5.10
0.5.00
0.4.20
0.4.10
0.4.00
0.3.190
0.3.180
0.3.170
0.3.160
0.3.150
0.3.140
0.3.130
0.3.120
0.3.110
0.3.100
0.3.90
0.3.80
0.3.70
0.3.60
0.3.50
0.3.40
0.3.30
0.3.20
0.3.10
0.3.00
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.280
0.1.270
0.1.260
0.1.251
0.1.240
0.1.230
0.1.220
0.1.210
0.1.200
0.1.180
0.1.170
0.1.50
0.1.40
0.1.30
0.1.20
0.1.11
0.1.00

Package Sidebar

Install

npm i @leanjs/vue-router

Weekly Downloads

17

Version

0.7.8

License

MIT

Unpacked Size

12.1 kB

Total Files

7

Last publish

Collaborators

  • leanjs