Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

radio

v1.1.32arrow_drop_down
v1.1.32
STATUS
Passing
DOWNLOADS
1
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
6 months ago
SIZE
946 B
1 contributor
Install radio as a package?
Copied
npm i @bit/myliang.fish-ui.radio
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Files
Radio.vue
32 Lines(32 sloc)
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
<template>
  <div :class="classObject" @click="clickHandler">
    <input type="radio"/>
    <label></label>
    <span><slot/></span>
  </div>
</template>
<script>
  export default {
    name: 'fish-radio',
    props: {
      index: { type: [String, Number], required: true },
      disabled: { type: Boolean, default: false }
    },
    data () {
      return {
        active: false
      }
    },
    computed: {
      classObject () {
        return ['fish radio', {'active': this.active}, {'disabled': this.disabled}]
      }
    },
    methods: {
      clickHandler (evt) {
        this.active = true
        evt.index = this.index
      }
    }
  }
</script>