index.vue 765 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div class="cus-title" :style="style">
  3. {{ text }}
  4. </div>
  5. </template>
  6. <script setup lang="ts" name="fmDashboardBasicTitle">
  7. import { defineProps, computed } from 'vue';
  8. import { titleProps } from './props';
  9. import { transformStyle } from '../../../../utils/transStyle';
  10. const props = defineProps(titleProps);
  11. const style = computed(() => {
  12. const style = transformStyle(props);
  13. const obj: Record<string, string> = {};
  14. if(style.color.length > 9) {
  15. obj.backgroundImage = style.color;
  16. obj.webkitBackgroundClip = 'text';
  17. obj.webkitTextFillColor = 'transparent';
  18. }
  19. return {
  20. ...obj,
  21. ...style,
  22. width: '100%',
  23. height: '100%',
  24. lineHeight: props.height + 'px'
  25. }
  26. });
  27. </script>
  28. <style lang="less" scoped>
  29. </style>