# vue-helper

> VueJS Helper

Latest version **0.0.5** (published 2021-10-29) · MIT License license · 0 weekly downloads

## Install

```sh
npm install vue-helper
pnpm add vue-helper
yarn add vue-helper
bun add vue-helper
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-10-29 |
| First published | 2021-07-31 |
| Weekly downloads | 0 |
| License | MIT License |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 72.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bayrell, vistoyn |

## Links

- npm: https://www.npmjs.com/package/vue-helper
- Homepage: https://github.com/bayrell/vue-helper
- npm.io page: https://npm.io/package/vue-helper

## Recent versions

- 0.0.5 (latest) — 2021-10-29
- 0.0.4 — 2021-10-12
- 0.0.3 — 2021-09-07
- 0.0.2 — 2021-07-31
- 0.0.1 — 2021-07-31

## README

# vue-helper

VueJS Helper

Declare state as class:
```

export class MainPageState
{
	username: string = "";


	/**
	 * Returns methods list
	 */
	static mutations(): Array<string>
	{
		let res: Array<string> =
		[
		];
		return res;
	}


	/**
	 * Returns modules
	 */
	static modules(): Record<string, any>
	{
		let res: Record<string, any> =
		{
		};
		return res;
	}

}


export class AppState
{
	MainPage: MainPageState = new MainPageState();


	/**
	 * Returns methods list
	 */
	static mutations(): Array<string>
	{
		let res: Array<string> =
		[
		];
		return res;
	}


	/**
	 * Returns modules
	 */
	static modules(): Record<string, any>
	{
		let res: Record<string, any> =
		{
			"MainPage": MainPageState,
		};
		return res;
	}

}
```

Create store from class:
```
/* Create app state */
let Store = buildStore(AppState);

/* Create app */
var app = createApp(App)
	.use(Store)
	.use(Router)
	.mount('#app')
```

Declare Vue component:
```
<style lang="scss" scoped>
</style>


<template>
	<div class="page_home">
		Hello {{ model.username }} !!!
	</div>
	<button @click="onClick">
		Click
	</button>
</template>

<script lang="js">

import { defineComponent } from 'vue';
import { mixin } from "vue-helper";

export default defineComponent({
	mixins: [ mixin ],
	computed:
	{
	},
	methods:
	{
		onClick()
		{
			console.log(this.model.username);
		}
	}
});

</script>
```

Declare Router:
```
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'MainPage',
		component: MainPage,
		props: { store_path: ["MainPage"] }
	},
]

const router = createRouter({
	history: createWebHistory("/"),
	routes
})

export default router
```

---
_Source: https://npm.io/package/vue-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
