he wei
2024-08-02 82c46b004deddd59755c16c8d67842b0d80d5d43
src/views/home/components/svg/svgInfo.vue
@@ -5,7 +5,7 @@
    :height="height"
  >
    <!-- foreignObject元素用于包裹非SVG元素 -->
    <div class="bg">
    <div :class="['bg', {alarm}]" :style="{'--bgColor': alarmColor, '--textColor': alarmTextColor}">
        <slot></slot>
    </div>
    <!-- 这里放入了HTML标签 -->
@@ -34,6 +34,18 @@
      type: String,
      default: "",
    },
    alarmColor: {
      type: String,
      default: '#FD865B'
    },
    alarmTextColor: {
      type: String,
      default: '#FFE871'
    },
    alarm: {
      type: Boolean,
      default: false
    },
  },
  data() {
    return {
@@ -46,7 +58,7 @@
};
</script>
<style scoped>
<style scoped lang="less">
.bg {
  height: 100%;
  box-sizing: border-box;
@@ -57,5 +69,10 @@
  display: flex;
  justify-content: center;
  align-items: center;
  &.alarm {
    background: var(--bgColor);
    border-color: var(--bgColor);
    color: var(--textColor);
  }
}
</style>