DeviceConfigCard.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="device-config-card">
  3. <view class="card-header">
  4. <text class="card-title">{{ title }}</text>
  5. <u-button
  6. v-if="showAction"
  7. type="primary"
  8. size="mini"
  9. @click="handleAction"
  10. >
  11. {{ actionText }}
  12. </u-button>
  13. </view>
  14. <view class="card-content">
  15. <slot></slot>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'DeviceConfigCard',
  22. props: {
  23. title: {
  24. type: String,
  25. default: '设备配置'
  26. },
  27. showAction: {
  28. type: Boolean,
  29. default: false
  30. },
  31. actionText: {
  32. type: String,
  33. default: '操作'
  34. }
  35. },
  36. methods: {
  37. handleAction() {
  38. this.$emit('action')
  39. }
  40. }
  41. }
  42. </script>
  43. <style lang="scss" scoped>
  44. @import '@/static/scss/custom-theme.scss';
  45. .device-config-card {
  46. @include card-style;
  47. margin-bottom: $custom-spacing-md;
  48. .card-header {
  49. @include flex-between;
  50. margin-bottom: $custom-spacing-md;
  51. padding-bottom: $custom-spacing-sm;
  52. border-bottom: 1px solid $custom-border-primary;
  53. .card-title {
  54. font-size: 16px;
  55. font-weight: bold;
  56. color: $custom-text-primary;
  57. }
  58. }
  59. .card-content {
  60. // 内容区域样式
  61. }
  62. }
  63. </style>