disabled property in Button component accepts string value.
See original GitHub issueSystem Information
OS: OS X El Capitan version 10.11.6 Browser: Google Chrome 65.0.3325.181(Official Build) (64 bit) bootstrap-vue: 2.0.0-rc.8",
Description
Hi
According to the bootstrap-vue document disabled
property accepts only boolean values. But there is a case that disabled
property accepts string
value.
Test Code
<template>
<b-button
:disabled="disable">Button</b-button>
</template>
<script>
import Vue from 'vue';
import bButton from 'bootstrap-vue/es/components/button/button';
Vue.component('b-button', bButton);
export default {
data() {
return {
disable: 'disabled',
};
},
};
</script>
Result
No errors in console
Expected Result
Expect to output this kind of error message ?
[Vue warn]: Invalid prop: type check failed for prop "disabled". Expected Boolean, got String.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The Disabled Attribute in React Buttons - Upmostly
Disabled is an attribute passed to React buttons. This means that it is passed into button components within JSX. In App.js: App.js.
Read more >How to add disabled attribute via prop to a button in react?
I am creating a custom button component in react. I want to pass a prop to that button, based on the value of...
Read more >HTML DOM Button disabled Property - W3Schools
The disabled property sets or returns whether a button is disabled, or not. A disabled element is unusable and un-clickable. Disabled elements are...
Read more >lightning-input - documentation - Salesforce Developers
When a field contains invalid characters, a default field-level error is displayed on blur and the value property returns an empty string. The...
Read more >How to Set the disabled state in Angular Button component
Button component can be enabled/disabled by giving disabled property. To disable Button component, the disabled property can be set as true . The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dany0502 your first comment was clear enough. I understand that the docs are a little bit confusing, if you don’t know the implementation details of Vue. Vue property validation is based on HTML specifications, where specific values are considered truthy even if their type is not
Boolean
.See this response of the creator of Vue, explaining why
''
is indeed a validBoolean
prop: https://github.com/vuejs/vue/issues/4710Further check this link and you will understand why
'disabled'
is valid: https://github.com/vuejs/vue/blob/7116af4e07520040ed7328c39d0a456808bfe1e1/src/platforms/web/util/attrs.js#L22I don’t see any problem here. This is a feature of Vue which provides different ways to disable elements. It’s not BootstrapVue related.
Please close this issue