
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
vue-disable-all-input
Advanced tools
A VueJs directive that allows you to disable/enable all input elements under a parent element
You may run into a scenario where you would want all input elements in a specific section to be disabled together. For example, clicking a button should disable all input elements in a form. In this case, instead of manually setting the disable attribute for each input element, you can bind v-disable-all-input
to the container element and simply toggle that flag instead.
$ npm i vue-disable-all-input
# or
$ yarn add vue-disable-all-input
import Vue from 'vue'
import VueDisableAllInput from 'vue-disable-all-input'
Vue.use(VueDisableAllInput)
Add v-disable-all-input
as an attribute to the parent element containing children input elements that you wish to disable/enable
<template>
<div>
<div v-disable-all-input="isDisabled">
<input type="text" />
<div class="child-div">
<button> Click me </button>
<input type="textarea" />
</div>
<input type="checkbox" />
<div contenteditable="true">
Editable Div
</div>
</div>
<button @click="isDisabled = !isDisabled"> Toggle Disable </button>
</div>
</template>
<script>
export default {
data () {
return {
isDisabled: false
}
}
}
</script>
You can also add v-disable-all-input
to a component, which will apply the disable/enable input logic to all child components recursively.
Parent Component
<template>
<div>
<button @click="isDisabled = !isDisabled"> Toggle </button>
<ChildComponent v-disable-all-input="isDisabled" />
</div>
</template>
<script>
import ChildComponent from './ChildComponent.vue';
export default {
components: {
ChildComponent
},
data() {
return {
isDisabled: false
}
}
}
</script>
Child Component
<template>
<div>
<div contenteditable="true">
Content Editable Div
</div>
<input type="text"/>
<input type="checkbox"/>
<button> Click me </button>
</div>
</template>
<script>
export default {
name: 'ChildComponent'
}
</script>
FAQs
Unknown package
The npm package vue-disable-all-input receives a total of 0 weekly downloads. As such, vue-disable-all-input popularity was classified as not popular.
We found that vue-disable-all-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.