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.
67 lines
1.0 KiB
67 lines
1.0 KiB
<template>
|
|
<view style="width: 100%;">
|
|
<u-radio-group :value="cvalue" @change="onChange">
|
|
<u-radio key="1" :name="1">{{labelYes}}
|
|
</u-radio>
|
|
<u-radio key="2" :name="2">{{labelNo}}
|
|
</u-radio>
|
|
</u-radio-group>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
value: {
|
|
type: Boolean | String | Number,
|
|
default: null
|
|
},
|
|
valueYes: {
|
|
type: Boolean | String | Number,
|
|
default: true
|
|
},
|
|
valueNo: {
|
|
type: Boolean | String | Number,
|
|
default: false
|
|
},
|
|
labelYes: {
|
|
type: String,
|
|
default: '是'
|
|
},
|
|
labelNo: {
|
|
type: String,
|
|
default: '否'
|
|
}
|
|
},
|
|
computed: {
|
|
cvalue() {
|
|
if (this.value == this.valueYes) {
|
|
return 1;
|
|
} else if (this.value == this.valueNo) {
|
|
|
|
return 2;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
|
|
}
|
|
},
|
|
methods: {
|
|
onChange(value) {
|
|
if (value == 1) {
|
|
this.$emit("input", this.valueYes)
|
|
} else if (value == 2) {
|
|
this.$emit("input", this.valueNo)
|
|
}
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|