You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vue-global-attrs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-global-attrs

Declaratively apply attributes to the the document element.

0.1.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

vue-global-attrs

Declaratively apply attributes to the the document element.

Inspired by vue-global-events.

Installation

npm install vue-global-attrs --save

Usage

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:

<GlobalAttrs
  v-if="attributesConnected"
  data-foo="bar"
  :data-hello="'world'"
/>

These attributes are applied (reactively) to the <html> element. The resulting DOM would look like this:

<html data-foo="bar" data-hello="world">

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

FAQs

Package last updated on 17 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts