computedStateStyle.js 741 B

123456789101112131415161718192021222324252627
  1. import { computed } from "vue"
  2. export function computedStateStyle() {
  3. /**
  4. * 状态颜色回显
  5. */
  6. const stateStyle = computed(() => {
  7. return function(state){
  8. if(state){
  9. if(state.value === 'pending'){
  10. return { color: 'rgba(243, 167, 63, 1)', backgroundColor: 'rgba(243, 167, 63, 0.16)' };
  11. } else if (state.value === 'handler'){
  12. return { color: 'rgba(0, 108, 249, 1)', backgroundColor: 'rgba(0, 108, 249, 0.16)' };
  13. } else if (state.value === 'close'){
  14. return { color: 'rgba(73, 184, 86, 1)', backgroundColor: 'rgba(73, 184, 86, 0.16)' };
  15. } else {
  16. return {}
  17. }
  18. }else{
  19. return {};
  20. }
  21. }
  22. })
  23. return {
  24. stateStyle
  25. };
  26. }