Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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.

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)