Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tobyzerner/vue-global-attrs
Declaratively apply attributes to the the document element.
https://github.com/tobyzerner/vue-global-attrs
attributes javascript vue
Last synced: 26 days ago
JSON representation
Declaratively apply attributes to the the document element.
- Host: GitHub
- URL: https://github.com/tobyzerner/vue-global-attrs
- Owner: tobyzerner
- License: mit
- Created: 2019-11-19T01:31:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T06:23:10.000Z (3 months ago)
- Last Synced: 2024-11-17T05:18:50.525Z (about 1 month ago)
- Topics: attributes, javascript, vue
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-global-attrs
> Declaratively apply attributes to the the document element.
Inspired by [vue-global-events](https://github.com/shentao/vue-global-events).
## Installation
```
npm install vue-global-attrs --save
```## Usage
```js
import GlobalAttrs from 'vue-global-attrs';// register globally
Vue.component('GlobalAttrs', GlobalAttrs)// or locally
export default {
components: { GlobalAttrs },
// rest of your component
}
```After that you can register global attributes like this:
```html
```
These attributes are applied (reactively) to the `` element. The resulting DOM would look like this:
```html
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](LICENSE)