平安校园
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

87 строки
1.7 KiB

  1. <template>
  2. <view>
  3. <myCell v-if="cellVisible" :title="title_" isLink :border="false" @click="show = true"></myCell>
  4. <u-popup :show="show" mode="center" :round="10" @close="close" @open="open">
  5. <u-radio-group v-model="value_" iconPlacement="right" placement="column" @change="change" borderBottom>
  6. <u-radio v-for="(item,index) in options" :key="index" :label="item.label" :name="item.value"></u-radio>
  7. </u-radio-group>
  8. </u-popup>
  9. </view>
  10. </template>
  11. <script>
  12. import myCell from "@/components/cell.vue"
  13. export default {
  14. name: "selectRadio",
  15. components:{
  16. myCell
  17. },
  18. props: {
  19. value: {
  20. default: "",
  21. type: String | Number
  22. },
  23. options: {
  24. default: [],
  25. type: Array
  26. },
  27. title:{
  28. default: "",
  29. type: String
  30. },
  31. cellVisible:true,
  32. },
  33. data() {
  34. return {
  35. show: false,
  36. title_:this.title,
  37. value_:this.value,
  38. };
  39. },
  40. mounted() {
  41. if(this.value){
  42. let obj = this.options.find(e1=>e1.value == this.value)
  43. if(obj) this.title_ = obj.label
  44. }
  45. },
  46. methods: {
  47. close() {
  48. this.show = false
  49. },
  50. open(){
  51. let obj = this.options.find(e1 => e1.value == this.value)
  52. if (obj) this.title_ = obj.label
  53. this.title_ = obj ? obj.label : this.title
  54. this.value_ = this.value
  55. },
  56. change(e) {
  57. this.$emit("update:value",e)
  58. let obj = this.options.find(e1=>e1.value == e)
  59. if(obj) this.title_ = obj.label
  60. this.$emit("change")
  61. },
  62. }
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. .u-radio-group {
  67. width: 550rpx;
  68. max-height: 680rpx;
  69. overflow-y: auto;
  70. padding: 0 24rpx;
  71. .u-cell {
  72. background-color: #fff;
  73. border-radius: 20rpx;
  74. padding: 24rpx 0;
  75. }
  76. }
  77. .u-border-bottom {
  78. border-color: #F6F6F6 !important;
  79. }
  80. .u-radio {
  81. margin-top: 18rpx;
  82. }
  83. </style>