Element: [Bug Report] el-checkbox not initialized checked when true-label=1

Created on 14 Apr 2019  ·  2Comments  ·  Source: ElemeFE/element

Element UI version

2.7.2

OS/Browsers version

Mac / Google Chrome 73.0.3683.103 (Official Build) (64-bit)

Vue version

2.5.13

Reproduction Link

https://jsfiddle.net/anatoly314/d6sgpncj/6/

Steps to reproduce

Use the following code to create checkbox:
<el-checkbox true-label=1 false-label=0 v-model="checkboxValue"></el-checkbox>

If checkboxValue is set to 1, checkbox not initiated as checked. When I click first time on checkbox, checkboxValue changed to 0 and on second click it changes value to 1 and checkbox now checked

What is Expected?

Checkbox need to be initiated as checked if v-model value bind to checkbox is set to 1 and true-label/false-label are 1/0 accordingly

What is actually happening?

checkbox being initiated unchecked

Most helpful comment

you should change the code like this, add v-bind or : before the true-label

<el-checkbox :true-label=1 :false-label=0 v-model="checkboxValue">{{checked}}</el-checkbox>

All 2 comments

you should change the code like this, add v-bind or : before the true-label

<el-checkbox :true-label=1 :false-label=0 v-model="checkboxValue">{{checked}}</el-checkbox>

Thank you very much, my mistake.

Was this page helpful?
0 / 5 - 0 ratings