# Chip Bone
# Introducción
Éste componente no está encargado de renderizar, es de uso interno del componente IrChip. Guía de uso parte lógica
# Código fuente
<script>
const propslocal = {
text: {
type: String,
default: ''
},
label: {
type: Boolean,
default: false
},
outlined: {
type: Boolean,
default: false
},
color: {
type: String,
required: false
},
'text-color': {
type: String,
required: false
},
'border-radius': {
type: String,
required: false
}
}
import {
normalizeProps,
assignCamelToSnake
} from '../../helpers/propsGenerator'
import { addOpacityToColor } from '../../helpers/manageColorStyles'
const mergedProps = normalizeProps(propslocal)
import { chipComponentName } from '../../constants'
import Vue, { onMounted, ref, h } from 'vue'
export default {
name: chipComponentName + 'Bone',
props: mergedProps,
setup(props, { slots }) {
const propError = Vue.prototype.$propError
const iclStore = Vue.prototype.$iclstore
const structureError = ref(false)
assignCamelToSnake(mergedProps, props)
onMounted(() => {
structureError.value = propError(propslocal, props, chipComponentName)
if (structureError.value) {
iclStore.commit('updateSnack', {
text: 'Ha ocurrido un error al cargar ' + chipComponentName,
active: true,
color: 'warning'
})
}
})
return () => {
if (structureError.value) {
return
}
return h(
'div', // Contenedor como nodo raíz
[
slots.default({
text: props.text,
label: props.label,
outlined: props.outlined,
color: props.color,
textColor: props.textColor,
borderRadius: props.borderRadius,
addOpacityToColor: addOpacityToColor
})
]
)
}
}
}
</script>
← Componente Componente →