iview动态加载有徽标数的radioGroup

html:

<radio-group>
<div class="aaa" id="a2">
            <radio-group v-model="timeValue1" @on-change="current_selected1" type='button'>
                <radio label="Cosmetic"></radio>
                <badge :count="count3">
                  <radio label="yk"></radio>
                    </badge>
            </radio-group>
          </div>

        <div class="aaa cc">
            <radio-group v-model="timeValue2" @on-change="current_selected2" type='button'>
              
              <span v-for="list in radioList">
                  <badge dot :count="list.num">
                      <radio :label="list.item"></radio>
                  </badge>
              </span>
              

              <!-- <radio v-for="list in radioList" :label="list"></radio> -->
          </radio-group>

js:(<badge dot :count="list.num"></badge> 中count为0则不显示小红点,其余都显示)

 this.radioList=[
          {
            'num':1,
            'item':'Total'
          },
          {
            'num':0,
            'item':'ggds'
          },
          {
            'num':0,
            'item':'fftert'
          },
          {
            'num':0,
            'item':'tthgfg'
          },
          {
            'num':1,
            'item':'rewewqeqw'
          },
          {
            'num':0,
            'item':'opds'
          },
        ]
      },

css

.ivu-radio-group-button .ivu-radio-wrapper-checked{
    background: #00a2ff;
    color: #fdfdfd;
}

猜你喜欢

转载自blog.csdn.net/yang__k/article/details/90544044