Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FInput): 修复复合型输入框样式问题 #867

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions components/input/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
&-prepend {
.group();
.group-prepend();
border-right: 0;
border-right: 1px solid transparent;
.border-right-pure();

}
&-append {
.group();
.group-append();
border-left: 0;
border-left: 1px solid transparent;
.border-left-pure();
}

Expand All @@ -43,6 +44,9 @@
border-spacing: 0;

> .@{input-prefix-cls}-inner {
// 提高中间输入框层级,避免边框和阴影被遮挡
position: relative;
z-index: 1;
vertical-align: middle;
}

Expand Down
44 changes: 44 additions & 0 deletions components/input/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,65 @@
}

.group-append() {
.hidden-append-border();
button.@{cls-prefix}-btn,
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select:hover .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader:hover .@{cls-prefix}-select-trigger {
.border-left-pure();
}
}


.group-prepend() {
.hidden-prepend-border();
button.@{cls-prefix}-btn,
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select:hover .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader:hover .@{cls-prefix}-select-trigger {
.border-right-pure();
}
}

.hover-light-border() {
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger {
border: 1px solid var(--f-primary-color);
}
}

.hidden-prepend-border {
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger {
border-right: 1px solid transparent;
}
}

.hidden-append-border {
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger {
border-left: 1px solid transparent;
}
}

.focus-light-border() {
div.@{cls-prefix}-select .@{cls-prefix}-select-trigger.is-active,
div.@{cls-prefix}-cascader .@{cls-prefix}-select-trigger.is-active,
div.@{cls-prefix}-select-cascader .@{cls-prefix}-select-trigger.is-active {
border: 1px solid var(--f-primary-color);
}
}

.group() {
position: relative;
z-index: 0;
display: table-cell;
box-sizing: border-box;
width: 1px;
Expand All @@ -48,7 +88,11 @@
background-color: var(--f-component-bg-color);
border: var(--f-border-base);
border-radius: var(--f-border-radius-base);
.focus-light-border();

&:hover {
.hover-light-border();
}
&:focus {
outline: none;
}
Expand Down
6 changes: 6 additions & 0 deletions docs/.vitepress/components/input/append.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
/>
</template>
</FInput>

<FInput placeholder="请输入">
<template #append>
.com
</template>
</FInput>
</FSpace>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/input/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ handleFocus.vue
| prefix | 前缀,只在 `type="text"` 时有效 |
| suffix | 后缀,只在 `type="text"` 时有效 |
| prepend | 前置内容,只在 `type="text"` 时有效 |
| append | 前置内容,只在 `type="text"` 时有效 |
| append | 后置内容,只在 `type="text"` 时有效 |

## Events

Expand Down