<template>
  <div id="c-btnbar">
    <el-row class="rows">
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-button v-for="i in fields" :key="i.method" :type="i.type ? i.type : 'primary'" plain size="mini" @click="toOpera(i)">{{ i.label }}</el-button>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'c-btnbar',
  props: {
    fields: { type: Array, default: () => [] },
  },
  data: function () {
    return {};
  },
  methods: {
    toOpera(item) {
      this.$emit(item.method);
    },
  },
};
</script>

<style lang="less" scoped>
.rows {
  margin: 20px 0;
}
</style>
