f9ae8d4e44d1fa77e03c16c3ea54d3a2364187bb.svn-base 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <a-radio-group
  3. :class="clazz"
  4. :value="innerValue"
  5. v-bind="cellProps"
  6. @change="(e)=>handleChangeCommon(e.target.value)"
  7. >
  8. <a-radio
  9. v-for="item of originColumn.options"
  10. :key="item.value"
  11. :value="item.value"
  12. @click="$event=>handleRadioClick(item,$event)"
  13. >{{ item.text }}
  14. </a-radio>
  15. </a-radio-group>
  16. </template>
  17. <script>
  18. import JVxeCellMixins from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
  19. export default {
  20. name: 'JVxeRadioCell',
  21. mixins: [JVxeCellMixins],
  22. computed: {
  23. scrolling() {
  24. return !!this.renderOptions.scrolling
  25. },
  26. clazz() {
  27. return {
  28. 'j-vxe-radio': true,
  29. 'no-animation': this.scrolling
  30. }
  31. },
  32. },
  33. methods: {
  34. handleRadioClick(item) {
  35. if (this.originColumn.allowClear === true) {
  36. // 取消选择
  37. if (item.value === this.innerValue) {
  38. this.handleChangeCommon(null)
  39. }
  40. }
  41. },
  42. },
  43. // 【组件增强】注释详见:JVxeCellMixins.js
  44. enhanced: {
  45. switches: {visible: true},
  46. }
  47. }
  48. </script>
  49. <style lang="less">
  50. // 关闭动画,防止滚动时动态赋值出现问题
  51. .j-vxe-radio.no-animation {
  52. .ant-radio-inner,
  53. .ant-radio-inner::after {
  54. transition: none !important;
  55. }
  56. }
  57. </style>