深圳设计网站排名,wordpress英文变成中文版,被忽悠去做网销了,义乌小商品市场进货渠道一、问题
element中的el-switch的值默认都是true或false#xff0c;但是有些时候后端接口该字段可能是0或者1#xff0c;如果说再转换一次值#xff0c;那就有点太费力了。如下所示#xff1a;
templateel-switchinactive-text否active-text但是有些时候后端接口该字段可能是0或者1如果说再转换一次值那就有点太费力了。如下所示
templateel-switchinactive-text否active-text是v-modelstatuschangechangeSwitch/
/template
script
export default {data() {return {status: false}},methods: {changeSwitch(e) {console.info(e)}}
}
/script二、解决
在el-switch中设置active-value和inactive-value属性接受Boolean, String或Number类型的值
el-switchinactive-text否active-text是active-value1inactive-value0v-modelstatus
/三、官方文档