获得徽章 7
昨晚下单了家庭ktv jbl kem3100 le,五千五。我家人喜欢唱歌,想买音响几年了,可是只有过年才在家,每次要买,都说不用放家里会熬坏。昨晚看到老爸用那几十块钱小音响唱歌,就立马下单了(炒股一天亏几千)。
6
3
又封装了一个组件,vuetify的样式真难改。<template>
<component :is="h(currentComp, mergeProps($attrs, defaultAttr), $slots)">
<template #message="item"
><slot name="message" v-bind="item">{{ item.message && $t(item.message) }}</slot></template
>
<template #label="item"
><slot name="label" v-bind="item">{{ item.label || '' }}{{ required ? '*' : '' }}</slot></template
>
</component>
</template>
<script setup lang="ts">
import { mergeProps } from 'vue'
import { VTextField, VTextarea } from 'vuetify/components'
type PropsType = {
componentType?: 'text' | 'textarea'
required?: boolean
}
const props = withDefaults(defineProps<PropsType>(), {
componentType: 'text',
required: false
})
const currentComp = computed(() => {
const compMap = {
text: VTextField,
textarea: VTextarea
}
return compMap[props.componentType] || ''
})
const defaultAttr = computed(() => {
return {
class: 'text-14',
density: 'compact',
variant: 'outlined',
hideDetails: 'auto'
}
})
</script>
<component :is="h(currentComp, mergeProps($attrs, defaultAttr), $slots)">
<template #message="item"
><slot name="message" v-bind="item">{{ item.message && $t(item.message) }}</slot></template
>
<template #label="item"
><slot name="label" v-bind="item">{{ item.label || '' }}{{ required ? '*' : '' }}</slot></template
>
</component>
</template>
<script setup lang="ts">
import { mergeProps } from 'vue'
import { VTextField, VTextarea } from 'vuetify/components'
type PropsType = {
componentType?: 'text' | 'textarea'
required?: boolean
}
const props = withDefaults(defineProps<PropsType>(), {
componentType: 'text',
required: false
})
const currentComp = computed(() => {
const compMap = {
text: VTextField,
textarea: VTextarea
}
return compMap[props.componentType] || ''
})
const defaultAttr = computed(() => {
return {
class: 'text-14',
density: 'compact',
variant: 'outlined',
hideDetails: 'auto'
}
})
</script>
展开
评论
点赞
![[无辜呆]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_96.4fb9d71.png)