Skip to content

Commit

Permalink
📝 docs(README.md): add usage instructions for VueFootprints
Browse files Browse the repository at this point in the history
This commit adds usage instructions for the VueFootprints package. It includes instructions for both the mixin and composable versions of the package. The options parameter is also documented, which includes the `returnRoute` option that can be used to include the `route` object in the `footprints` array.

🔧 chore(package.json): add eslint and related packages, add lint script, add peer dependencies
This commit adds eslint and related packages to the project, including eslint-config-standard, eslint-plugin-import, eslint-plugin-n, eslint-plugin-promise, eslint-plugin-vue, and eslint-webpack-plugin. A lint script is also added to the package.json file. Additionally, peer dependencies for vue and vue-router are added to the package.json file.
  • Loading branch information
jofftiquez committed May 11, 2023
1 parent 6f2cef4 commit e3dd71b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,54 @@ Breadcrumbs plugin for Vue.js & Vue Router. Why footprints? Coz it's similar to
**Yarn**

```bash
yarn add vue-footprints
yarn add @ossph/vue-footprints
```

**NPM**

```bash
npm install vue-footprints
npm install @ossph/vue-footprints
```

## Usage

### Mixin

This will add a global computed mixin array called `$footprints`. Remember this one, we'll talk about it in the implmentation part.

```js
import { createApp } from 'vue'
import VueFootprints from 'vue-footprints';
import { VueFootprintsMixin } from '@ossph/vue-footprints';

const app = createApp({});

app.use(VueFootprints);
app.use(VueFootprintsMixin, { returnRoute: true });
```

### Composable

You can also create a local implementation using the composable version.

```js
import { useRoute } from 'vue-router';

export default {
setup () {
const route = useRoute();
const { footprints } = useFootprints(route, { returnRoute: true });
// footprints.value yields an array of route footprints
},
};
```

### Options

Both the mixin installation and the composable have the same options parameters.

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `returnRoute` | `Boolean` | `false` | If `true`, the `route` object will be returned in the `footprints` array. |

## Implementation with Vue App

**Step 1**
Expand Down
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "vue-footprints",
"name": "@ossph/vue-footprints",
"version": "1.0.0",
"description": "Breadcrumbs for Vue.js with Vue Router",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --fix --ext .js,.vue ./",
"build": "rollup --config"
},
"repository": {
Expand All @@ -30,6 +31,18 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-terser": "^0.4.0",
"eslint": "^8.10.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^9.0.0",
"eslint-webpack-plugin": "^3.1.1",
"rollup": "^3.10.1"
}
},
"peerDependencies": {
"vue": "^3.3.1",
"vue-router": "^4.1.6"
},
"dependencies": {}
}

0 comments on commit e3dd71b

Please sign in to comment.