<template>
  <div class="QdmButton">
    <el-button
    :disabled="disabled"
    :type="type"
    @click.stop="click"
    :style="'line-height:' + height + 'px;height:' + height + 'px;background:' + background + ';color:' + color + ';font-size:' + size + 'px;border-color:' + background + ';'">
    <i v-if="icon !== ''" class="iconfont" :class="icon"></i>
    {{ name }}
    </el-button>
  </div>
</template>
<script>
export default {
  name: "QdmButton",
  props: {
		type: {
      type: String,
      default: 'primary'
    },
    name: {
      type: String,
      default: ''
    },
    height: {
			type: Number,
			default: 30
    },
    background: {
			type: String,
			default: '#fff'
    },
    color: {
			type: String,
			default: '#333'
    },
    size: {
			type: Number,
			default: 12
    },
    disabled: {
			type: Boolean,
			default: false
    },
    icon: {
			type: String,
			default: ''
		}
	},
	data() {
		return {
			authority: [],
			btnName: '',
			btnNameList: [
				{ name: '查询', code: 'query' },
				{ name: '添加', code: 'add' },
				{ name: '新增', code: 'new' },
				{ name: '重置', code: 'reset' },
				{ name: '导出', code: 'export' },
				{ name: '保存', code: 'save' },
				{ name: '编辑', code: 'edit' },
				{ name: '删除', code: 'delete' },
				{ name: '禁用', code: 'forbidden' },
				{ name: '启用', code: 'enable' },
				{ name: '解锁', code: 'unlock' },
				{ name: '导入', code: 'import' },
				{ name: '详情', code: 'detail' },
				{ name: '排序', code: 'sort' },
				{ name: '列', code: 'line' },
				{ name: '分配', code: 'allocation' },
				{ name: '完结', code: 'end' },
				{ name: '关联', code: 'relevance' },
				{ name: '关闭', code: 'close' },
				{ name: '拒绝', code: 'refuse' },
				{ name: '上架', code: 'putaway' },
				{ name: '下架', code: 'soldout' },
				{ name: '查看', code: 'check' }
			]
		}
	},
	methods: {
		click() {
			this.$emit('click')
		}
  }
}
</script>
<style lang="less">
div {
	&::after {
		content: '';
		height: 0;
		line-height: 0;
		display: block;
		visibility: hidden;
		clear: both;
	}
}
.QdmButton {
	float: left;
	margin-right: 12px;
	.el-button {
		padding: 0 15px;
		min-height: 30px;
		&.is-disabled {
			color: #C0C4CC !important;
			cursor: not-allowed !important;
			background-image: none !important;
			background-color: #FFF !important;
			border-color: #EBEEF5 !important;
		}
	}
	&:last-child {
		margin-right: 0px;
	}
	i {
		font-size: 15px;
		float: left;
		margin-right: 3px;
	}
}
</style>