查询按钮组件

 <!-- 查询按钮组件-->
<template>
  <el-form>
    <el-form-item v-for="button in buttonArr"
                  :key="button.index"
                  :index="button.index">
      <slot name="tuns-specific-button"
            :button="button"
            v-if="button.showType == 'specific'"></slot>
      <el-button :type="button.type"
                 @click="handleClick(button)"
                 :size="button.size"
                 :disabled="disableBool[button.btnType]"
                 :loading="loadingBool[button.btnType]"
                 v-else>{{ button.text }}</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
/**
 * 批量按钮组件
 * @param {object} disableBool 按钮禁用对象 {insert:true,update:false}
 * @param {object} loadingBool 按钮加载对象 {insert:true,update:false}
 * @param {object} showBool 按钮显示对象 {insert:true,update:false}
 * @param {array} btnConfig 配置参数数组
 * 数组中包含
 *   @param {string} type 按钮类型	primary / success / warning / danger / info / text
 *   @param {string} size	尺寸		medium / small / mini
 *   @param {string} btnType 按钮业务类型 insert/delete/update/select/start/stop
 *   @param {string} operType 界面按钮对应菜单按钮数据 A/B/C/D/E
 *   @param {string} text 按钮显示内容
 *
 */
export default {
  name: "filter-btn",
  props: {
    btnConfig: {
      type: Array,
      default: () => {
        return [];
      },
    },
    showBool: {
      type: Object,
      default: () => {
        return {};
      },
    },
    disableBool: {
      type: Object,
      default: () => {
        return {};
      },
    },
    loadingBool: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  computed: {
    buttonArr () {
      const arr = [];
      if (this.btnConfig && this.btnConfig.length)
        this.btnConfig.map((btn) => {
          if (this.showBool[btn.btnType]) arr.push(btn);
        });
      return arr;
    },
  },
  methods: {
    /**
     * 按钮点击事件 不在组件中做业务处理 往上传至业务组件进行处理
     * @param {object} val 按钮数据
     */
    handleClick (val) {
      console.log('按钮点击事件', val);
      this.$emit("handleClick", val);
    },
  },
};
</script>

<style>
</style>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值