| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- const n = `<template>
- <div
- class="filter-item"
- :class="{ 'is-full': props.full, 'is-default': isNormal }"
- :style="itemStyle"
- >
- <div
- class="label"
- :style="{
- width: props.labelWidth + 'px',
- maxWidth: props.labelWidth + 'px',
- minWidth: props.labelWidth + 'px'
- }"
- >
- {{ label }}{{ props.colon ? ':' : '' }}
- </div>
- <div class="value">
- <slot />
- </div>
- </div>
- </template>
- <script setup>
- import { computed, onMounted } from 'vue'
- const props = defineProps({
- // 标签文案(必填)
- label: {
- required: true,
- type: String
- },
- // 标签宽度,单位 px
- labelWidth: {
- type: Number,
- default: 70
- },
- // 标签后是否带冒号
- colon: {
- type: Boolean,
- default: false
- },
- // 表单项宽度,单位 px(full 为 true 时失效)
- width: {
- type: Number,
- default: 280
- },
- // 独占一行:父级 SFilterWrap 是 flex-wrap 容器,宽度拉满即整行
- full: {
- type: Boolean,
- default: false
- },
- // 底部外边距,单位 px
- mb: {
- type: Number,
- default: 0
- },
- // 默认描边样式;false 为无边框样式
- isNormal: {
- type: Boolean,
- default: true
- }
- })
- const itemStyle = computed(() => ({
- width: props.full ? '100%' : props.width + 'px',
- marginBottom: props.mb + 'px'
- }))
- onMounted(() => {})
- <\/script>
- <style lang="less" scoped>
- .filter-item {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- &.is-full {
- flex: 1 1 100%;
- min-width: 0;
- }
- .label {
- height: 32px;
- display: flex;
- justify-content: flex-start;
- align-content: center;
- line-height: 1;
- display: flex;
- align-items: center;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- word-break: break-all;
- // margin-right: 8px;
- }
- .value {
- flex: 1;
- overflow: hidden;
- :deep(.ant-select) {
- width: 100%;
- }
- }
- &.is-default {
- border: 1px solid var(--s-border-color-light);
- border-radius: 4px;
- .label {
- margin-right: 0;
- justify-content: center;
- color: var(--s-text-color-regular);
- background-color: var(--s-menu-bg);
- }
- .value {
- :deep(.ant-select) {
- border-radius: 0;
- }
- :deep(*) {
- background-color: transparent;
- border: none;
- outline: none;
- border-radius: 0;
- .ant-select-selector {
- background-color: transparent;
- border: none;
- outline: none;
- border-radius: 0;
- }
- }
- }
- }
- }
- </style>
- `;
- export {
- n as default
- };
|