Blame view

ant-design-vue-jeecg/src/components/JVxeCells/JVxeRadioCell.vue 1.26 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<template>
  <a-radio-group
    :class="clazz"
    :value="innerValue"
    v-bind="cellProps"
    @change="(e)=>handleChangeCommon(e.target.value)"
  >
    <a-radio
      v-for="item of originColumn.options"
      :key="item.value"
      :value="item.value"
      @click="$event=>handleRadioClick(item,$event)"
    >{{ item.text }}
    </a-radio>
  </a-radio-group>
</template>

<script>
肖超群 authored
19
import JVxeCellMixins from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
肖超群 authored
20
肖超群 authored
21
22
23
24
25
26
27
28
29
30
31
32
export default {
  name: 'JVxeRadioCell',
  mixins: [JVxeCellMixins],
  computed: {
    scrolling() {
      return !!this.renderOptions.scrolling
    },
    clazz() {
      return {
        'j-vxe-radio': true,
        'no-animation': this.scrolling
      }
肖超群 authored
33
    },
肖超群 authored
34
35
36
37
38
39
40
  },
  methods: {
    handleRadioClick(item) {
      if (this.originColumn.allowClear === true) {
        // 取消选择
        if (item.value === this.innerValue) {
          this.handleChangeCommon(null)
肖超群 authored
41
        }
肖超群 authored
42
      }
肖超群 authored
43
    },
肖超群 authored
44
45
46
47
  },
  // 【组件增强】注释详见:JVxeCellMixins.js
  enhanced: {
    switches: {visible: true},
肖超群 authored
48
  }
肖超群 authored
49
}
肖超群 authored
50
51
52
</script>

<style lang="less">
肖超群 authored
53
54
55
56
57
// 关闭动画,防止滚动时动态赋值出现问题
.j-vxe-radio.no-animation {
  .ant-radio-inner,
  .ant-radio-inner::after {
    transition: none !important;
肖超群 authored
58
  }
肖超群 authored
59
}
肖超群 authored
60
</style>