toolbar-panel.vue 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div class="com-panel" :class="{ 'no-title': !hasTitle, line: showLine }">
  3. <div v-if="hasTitle" class="panel-header">
  4. <div class="panel-title">
  5. <i v-if="hasIcon" class="panel-icon" :class="icon"></i>
  6. {{ title }}
  7. </div>
  8. <div class="panel-tools">
  9. <slot name="tools"></slot>
  10. </div>
  11. </div>
  12. <div class="panel-body">
  13. <slot></slot>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. // 副标题可嵌入html的panel
  19. export default {
  20. name: "toolbar-panel",
  21. componentName: "toolbar-panel",
  22. props: {
  23. // 标题
  24. title: String,
  25. // 图标
  26. icon: String,
  27. showLine: {
  28. type: Boolean,
  29. default: true,
  30. },
  31. },
  32. computed: {
  33. hasTitle() {
  34. if (this.title) return true;
  35. return false;
  36. },
  37. hasIcon() {
  38. if (this.icon) return true;
  39. return false;
  40. },
  41. },
  42. };
  43. </script>
  44. <style lang="less"></style>