c-btnbar.vue 691 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div id="c-btnbar">
  3. <el-row class="rows">
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <el-button v-for="i in list" :key="i.method" :type="i.type ? i.type : 'primary'" plain size="mini" @click="toOpera(i)">{{ i.label }}</el-button>
  7. <slot></slot>
  8. </el-col>
  9. </el-col>
  10. </el-row>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'c-btnbar',
  16. props: {
  17. list: { type: Array, default: () => [] },
  18. },
  19. data: function () {
  20. return {};
  21. },
  22. methods: {
  23. toOpera(item) {
  24. this.$emit(item.method);
  25. },
  26. },
  27. };
  28. </script>
  29. <style lang="less" scoped>
  30. .rows {
  31. margin: 20px 0;
  32. }
  33. </style>