NVS
This is a simple helper function to add to your project. It coverts an object of (conditional) classnames to a class string. You can youse it to dynamically add classes to your (Vue) components.
Installation
-
yarn add @netvlies/classes-helper -D
ornpm i @netvlies/classes-helper --save-dev
- Import the helper in your code.
Your JS should look something like this:
Vue
import { classesCreator } from "@netvlies/classes-helper"
export default {
name: 'NvsHeading',
data: () => ({
module: 'a-heading',
}),
computed: {
moduleClasses () {
return classesCreator({
[this.module]: true
})
}
}
}
Want to collaborate?
Please edit the config file and submit a merge request. One of the maintainers with NPM access will submit the update to NPM.
Maintainers
Name | NPM Publish rights |
---|---|
Berrie Nachtweh | Yes |