-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MdCheckBox): True / false value supporting (#1703)
* feat(MdCheckBox): True / false value supporting support true-value and false-value for checkboxes BREAKING CHANGE: checkbox without setting value is true / false as default fix #1701 * fix(MdCheckbox): better native value binding
- Loading branch information
1 parent
a4e3619
commit 7cdcb66
Showing
4 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
docs/app/pages/Components/Checkbox/examples/TrueFalseValue.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<div> | ||
<div class="block"> | ||
<div class="title">Without <code>:true-value</code> / <code>:false-value</code></div> | ||
<div class="input"> | ||
<md-checkbox v-model="withoutSetValue">{{withoutSetValue|jsonStringify}}</md-checkbox> | ||
</div> | ||
</div> | ||
|
||
<md-divider /> | ||
|
||
<div class="block"> | ||
<div class="title">With <code>:true-value</code> / <code>:false-value</code></div> | ||
<div class="input"> | ||
<md-checkbox v-model="withSetValue" true-value="true" false-value="false">{{withSetValue|jsonStringify}}</md-checkbox> | ||
</div> | ||
</div> | ||
|
||
<md-divider /> | ||
|
||
<div class="block"> | ||
<div class="title">Native checkbox with <code>:true-value</code> / <code>:false-value</code></div> | ||
<div class="input"> | ||
<label><input type="checkbox" v-model="native" true-value="true" false-value="false" value="test" />{{native|jsonStringify}}</label> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'TrueFalseValue', | ||
data () { | ||
return { | ||
withoutSetValue: null, | ||
withSetValue: null, | ||
native: null | ||
} | ||
}, | ||
filters: { | ||
jsonStringify (val) { | ||
return JSON.stringify(val) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.block:not(:first-child) { | ||
margin-top: 32px; | ||
} | ||
.title { | ||
font: 1.2em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters