| | |
| | | :height="height" |
| | | > |
| | | <!-- foreignObject元素用于包裹非SVG元素 --> |
| | | <div class="bg"> |
| | | <div :class="['bg', {alarm}]" :style="{'--bgColor': alarmColor, '--textColor': alarmTextColor}"> |
| | | <slot></slot> |
| | | </div> |
| | | <!-- 这里放入了HTML标签 --> |
| | |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | alarmColor: { |
| | | type: String, |
| | | default: '#FD865B' |
| | | }, |
| | | alarmTextColor: { |
| | | type: String, |
| | | default: '#FFE871' |
| | | }, |
| | | alarm: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style scoped lang="less"> |
| | | .bg { |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | &.alarm { |
| | | background: var(--bgColor); |
| | | border-color: var(--bgColor); |
| | | color: var(--textColor); |
| | | } |
| | | } |
| | | </style> |