【ele-form-search】 组件 padding-bottom 设置动态计算【便于确定按钮位置】

<template>
  <div class="container">
    <ele-form-search
      class="container_search"
      :style="searchStyle"
      :form-data="searchData"
      :form-desc="searchDesc"
      @search="fetchData"
    />
  </div>
</template>

<script>
export default {
  // ...
  computed: {
    //...
    searchDesc() {
      return {
        xsly: {
          type: 'radio',
          label: '线索来源',
          layout: 24,
          options: xslyOptions,
          required: true,
          render(h, content, value) {
            return <span>{filter_list(value, xslyOptions)}</span>
          }
        },
        lsh: {
          vif: ['vehCheck', 'otherCheck'].includes(_this.formData.xsly),
          type: 'input',
          label: '流水号',
          layout: 24,
          required: !['otherCheck'].includes(_this.formData.xsly)
        },
        fzjg: {
          type: 'input',
          label: '盟市',
          layout: 24,
          required: !['otherCheck'].includes(_this.formData.xsly)
        },
        jczmc: {
          vif: ['vehCheck', 'otherCheck'].includes(_this.formData.xsly),
          type: 'select',
          label: '网点名称',
          layout: 24,
          options: _this.jczmcOptions,
          required: !['otherCheck'].includes(_this.formData.xsly),
          attrs: {
            clearable: true
          },
          render(h, content, value) {
            return <span>{filter_list(value, _this.jczmcOptions)}</span>
          }
        },
        sjcs: {
          vif: ['reviewCheck'].includes(_this.formData.xsly),
          type: 'input',
          label: '网点名称',
          layout: 24,
          required: true,
          attrs: {
            clearable: true
          }
        },
      }
    },
    // 【主要代码】
    searchStyle() {
      let layoutCount = 0
      Object.keys(this.searchDesc).forEach((key) => {
        this.searchDesc[key].vif !== false && (layoutCount += this.searchDesc[key].layout || 6)
      })
      return {
        '--paddingBottom': layoutCount % 24 === 0 ? '40px' : '0px'
      }
    }
  },
}
</script>

<style lang="scss" scoped>
.container_search {
   padding: 10px 10px  var( 按钮位置); /* 【主要代码】 */
   margin-bottom: 10px;
 }
</style>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值