Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/hojas/vue-use-context
- Owner: hojas
- License: mit
- Created: 2023-07-26T09:30:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-27T01:51:58.000Z (over 1 year ago)
- Last Synced: 2024-11-25T09:04:32.126Z (about 1 month ago)
- Topics: context, vue
- Language: TypeScript
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 }}```