Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hojas/vue-use-context

Get Vue globalProperties easily in setup.
https://github.com/hojas/vue-use-context

context vue

Last synced: 28 days ago
JSON representation

Get Vue globalProperties easily in setup.

Awesome Lists containing this project

README

        

# vue-use-context

![npm](https://img.shields.io/npm/v/vue-use-context) ![npm](https://img.shields.io/npm/dw/vue-use-context)

Get Vue globalProperties easily in setup.

## Install

```shell
$ npm install vue-use-context
```

## Use

main.ts

```ts
import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)
app.config.globalProperties.$name = 'name'

app.mount('#app')
```

App.vue

```vue

import { useContext } from 'vue-use-context'
const { $name } = useContext()

{{ $name }}

```