You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
975 B
50 lines
975 B
6 years ago
|
<template>
|
||
|
<div class="form-check-radio">
|
||
|
<label :for="cbId" class="form-check-label">
|
||
|
<input :id="cbId"
|
||
|
type="radio"
|
||
|
:disabled="disabled"
|
||
|
:value="label"
|
||
|
v-model="model" />
|
||
|
<span class="form-check-sign">
|
||
|
<slot></slot>
|
||
|
</span>
|
||
|
</label>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
|
export default {
|
||
|
name: 'p-radio',
|
||
|
props: {
|
||
|
label: [String, Number],
|
||
|
disabled: [Boolean, String],
|
||
|
value: [String, Boolean],
|
||
|
inline: Boolean
|
||
|
},
|
||
|
data () {
|
||
|
return {
|
||
|
cbId: ''
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
model: {
|
||
|
get () {
|
||
|
return this.value
|
||
|
},
|
||
|
set (value) {
|
||
|
this.$emit('input', value)
|
||
|
}
|
||
|
},
|
||
|
inlineClass () {
|
||
|
if (this.inline) {
|
||
|
return `radio-inline`
|
||
|
}
|
||
|
return ''
|
||
|
}
|
||
|
},
|
||
|
created () {
|
||
|
this.cbId = Math.random().toString(16).slice(2)
|
||
|
}
|
||
|
}
|
||
|
</script>
|