File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
frontend_vue/src/components/base Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 11<template >
2- <p class =" text-xs rounded-xl px-16 py-4 inline-block text-nowrap"
3- :class =" `bg-${backgroundColour} text-${textColour}`"
2+ <p
3+ class =" text-xs rounded-xl px-16 py-4 inline-block text-nowrap"
4+ :class =" getColourClasses(props.colour)"
45 >
56 <slot ></slot >
67 </p >
910<script setup lang="ts">
1011
1112const props = defineProps ({
12- backgroundColour : {
13+ colour : {
1314 type: String ,
1415 default: ' grey'
1516 },
16- textColour: {
17- type: String ,
18- default: ' white'
19- }
2017});
18+
19+ function getColourClasses(colour : string ): string {
20+ switch (colour ) {
21+ case ' grey' :
22+ return ' bg-grey-400 text-white' ;
23+ // add more colours here as needed
24+ default :
25+ return ' bg-grey-400 text-white' ;
26+ }
27+ }
28+
2129 </script >
You can’t perform that action at this time.
0 commit comments