elementUI 单选框按钮样式,用el-radio-group标签嵌套着el-radio-button,就是单选框的按钮样式
可以通过size属性,指定单选框按钮的大小,size属性可选的值有medium,small,mini
el-radio-button的其他用法和el-radio一样
例子:
<template> <div> <el-radio-group v-model="radio" @change="getValue()" size="mini"> <el-radio-button v-for="(item,i) in items" :key="i" :label="i" :disabled="item.disabled">{{item.content}}</el-radio-button> </el-radio-group> </div> </template> <script> export default { name: "HelloWorld", data () { return { radio:0, items:[ {id:0,content:"选项一",disabled:false}, {id:1,content:"选项二",disabled:true}, {id:2,content:"选项三",disabled:false}, ] }; }, methods: { getValue(){ console.log(this.radio) } }, } </script> <style lang="css" scoped> </style>
原文地址:https://www.cnblogs.com/luguankun/p/11623900.html
时间: 2024-10-08 00:45:07