|
@@ -6,25 +6,27 @@
|
|
|
<script setup>
|
|
|
import { computed } from 'vue'
|
|
|
const props = defineProps({
|
|
|
- icon: String
|
|
|
+ icon: String | Array
|
|
|
})
|
|
|
const colors = {
|
|
|
GET: '#0cbb52',
|
|
|
POST: '#FFB400',
|
|
|
DELETE: ['DEL', '#EB2013'],
|
|
|
PUT: '#097BED',
|
|
|
- 'function': ['Fn', '#9012FE'],
|
|
|
- 'websocket': ['WS', '#6B6B6B'],
|
|
|
- 'task': ['TASK', '#9012FE'],
|
|
|
- 'resource': ['RES', '#9012FE']
|
|
|
+ 'function': ['Fn', '#9012FE']
|
|
|
}
|
|
|
const item = computed(() => {
|
|
|
- let values = colors[props.icon]
|
|
|
- const isArray = values !== undefined && Array.isArray(values)
|
|
|
+ let values = props.icon
|
|
|
+ let isArray = Array.isArray(values)
|
|
|
+ if(!isArray) {
|
|
|
+ values = colors[props.icon]
|
|
|
+ isArray = values !== undefined && Array.isArray(values)
|
|
|
+ }
|
|
|
const text = isArray ? values[0] : props.icon
|
|
|
const width = text.length * 9
|
|
|
const color = isArray ? values[1] : (values || 'var(--main-icon-color)')
|
|
|
+ console.log({ width, color, text})
|
|
|
return { width, color, text}
|
|
|
})
|
|
|
|
|
|
-</script>
|
|
|
+</script>
|