vue---el-switch值true、false改为number类型的1和0

需求描述:后端传回的status值为1(number类型)对应el-switch值true(打开)状态,status值为0(number类型)对应el-switch值false(关闭)状态。

<el-switch 
	active-value="1" 
	inactive-value="0" 
	v-model="menuInfoForm.status">
</el-switch>

说明:当用如上的【active-value=“1” inactive-value=“0”】,此时的【active-value】值类型为string,如果要求【active-value】值类型为number时,必须在其前面加上:

<el-switch 
	:active-value="1" 
	:inactive-value="0" 
	v-model="menuInfoForm.status">
</el-switch>

你可能感兴趣的:(vue,elementui)