iview使用多选框实现单选功能

 <CheckboxGroup v-model="detailData.payType" @on-change="getPayTypeFun">
                            <Checkbox label="0" :disabled="isEdit">现金</Checkbox>
                            <Checkbox label="1" :disabled="isEdit">银转</Checkbox>
                            <Checkbox label="2" :disabled="isEdit">汇票</Checkbox>
                            <Checkbox label="3" :disabled="isEdit">网上支付</Checkbox>
</CheckboxGroup>
 
 
   // 支付方式
            getPayTypeFun(data) {
                if (data.length > 1) {
                    this.detailData.payType = []
                    let i=String(data.length-1)
                    this.detailData.payType = [data[i]]
                }
            },
posted @ 2020-05-28 16:34  苏小白啊  阅读(2511)  评论(0编辑  收藏  举报