• 修改el-radio-group样式,自定义单选组件


    修改el-radio-group样式,自定义单选组件

    在这里插入图片描述

    • 自定义组件 MyRadioGroup.vue
    <template>
      <div class="btnsBox">
        <el-radio-group v-model="activeIndex" @change="handleClick">
          <el-radio-button
            v-for="(item, index) in list"
            :key="item"
            :label="index"
            >{{ item }}el-radio-button
          >
        el-radio-group>
      div>
    template>
    
    <script>
    export default {
      props: {
        list: {
          type: Array,
          default: () => {
            return ["北京", "上海"];
          },
        },
      },
      data() {
        return {
          activeIndex: 0,
        };
      },
    
      mounted() {},
    
      methods: {
        handleClick() {
          this.$emit("click", this.activeIndex);
        },
      },
    };
    script>
    
    <style lang="less" scoped>
    /deep/.el-radio-button__inner {
      padding: 8px 18px;
      background: rgba(0, 255, 244, 0.32);
      border: 1px solid #00fff4;
      border-radius: 0;
      font-size: 19px;
      font-family: jc500;
      font-weight: normal;
      color: #ffffff;
      text-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.73);
      opacity: 0.52;
    }
    /deep/.el-radio-button:last-child .el-radio-button__inner {
      border-radius: 0;
    }
    /deep/.el-radio-button:first-child .el-radio-button__inner {
      border-radius: 0;
      border-left: 1px solid #00fff4;
    }
    /deep/.el-radio-button__orig-radio:checked + .el-radio-button__inner {
      border: 1px solid #00fff4;
      opacity: 1;
      background: rgba(0, 255, 244, 0.32);
    }
    style>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
  • 相关阅读:
    Vue3中使用provide和inject依赖注入完成父组件和孙子组件之间参数传递
    工控安全方案分析
    dataX源码学习
    《rk3399:基于一个物理网卡设置两个网络接口》
    java.io.File类常用的方法
    DP83848+网线热拔插
    数据结构【DS】图的遍历
    Docker提交天池比赛流程
    改革后IB数学该如何选?
    Node.js -- fs模块
  • 原文地址:https://blog.csdn.net/zhao3756/article/details/134514908