c_tab.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div style="margin-bottom: 20px">
  3. <div class="title-tips" v-if="configData.tabList">
  4. <span>{{ configData.title }}</span
  5. >{{ configData.tabList[configData.tabVal].name }}
  6. </div>
  7. <div class="radio-box" :class="{ on: configData.type == 1 }">
  8. <RadioGroup v-model="configData.tabVal" type="button" size="large" @on-change="radioChange($event)">
  9. <Radio :label="index" v-for="(item, index) in configData.tabList" :key="index">
  10. <span class="iconfont-diy" :class="item.icon" v-if="item.icon"></span>
  11. <span v-else>{{ item.name }}</span>
  12. </Radio>
  13. </RadioGroup>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'c_tab',
  20. props: {
  21. configObj: {
  22. type: Object,
  23. },
  24. configNme: {
  25. type: String,
  26. },
  27. },
  28. data() {
  29. return {
  30. formData: {
  31. type: 0,
  32. },
  33. defaults: {},
  34. configData: {},
  35. };
  36. },
  37. watch: {
  38. configObj: {
  39. handler(nVal, oVal) {
  40. this.defaults = nVal;
  41. this.configData = nVal[this.configNme];
  42. },
  43. deep: true,
  44. },
  45. },
  46. mounted() {
  47. this.$nextTick(() => {
  48. this.defaults = this.configObj;
  49. this.configData = this.configObj[this.configNme];
  50. });
  51. },
  52. methods: {
  53. radioChange(e) {
  54. if (this.defaults.picStyle) {
  55. this.defaults.picStyle.tabVal = 0;
  56. }
  57. this.$emit('getConfig', e);
  58. },
  59. },
  60. };
  61. </script>
  62. <style scoped lang="stylus">
  63. .ivu-radio-group-button.ivu-radio-group-large .ivu-radio-wrapper:after{
  64. height 0
  65. }
  66. .ivu-radio-group-button.ivu-radio-group-large .ivu-radio-wrapper{
  67. height 34px;
  68. }
  69. .ivu-radio-group-button .ivu-radio-wrapper:nth-of-type(2){
  70. border-left 1px solid #dcdee2
  71. }
  72. .radio-box
  73. /deep/.ivu-radio-group-button
  74. display flex
  75. width 100%
  76. flex-wrap: wrap
  77. .ivu-radio-wrapper
  78. flex 1
  79. display flex
  80. align-items center
  81. justify-content center
  82. &.on
  83. /deep/.ivu-radio-group-button
  84. .ivu-radio-wrapper
  85. flex unset
  86. width 67px
  87. margin-right 20px
  88. border-radius 4px
  89. .title-tips
  90. padding-bottom 10px
  91. font-size 14px
  92. color #333
  93. span
  94. margin-right 14px
  95. color #999
  96. .iconfont-diy
  97. font-size 20px
  98. line-height 18px
  99. </style>