完成 input 与 textarea 样式拆解

This commit is contained in:
就眠儀式 2022-02-09 10:37:44 +08:00
parent 8a8bc6b0b5
commit 0c4e9e21c4
11 changed files with 153 additions and 43 deletions

View File

@ -296,9 +296,20 @@ export default {
::: title 主题配置 ::: title 主题配置
::: :::
<p style="margin-left: 30px">less</p>
``` ```
@button-primary-color: #009688; // 主题色 @button-primary-color: #009688; // 主题色
@button-border-radius: 2px; // 圆角 @button-border-radius: 2px; // 圆角
@button-border-color: #d2d2d2; // 边框色
```
<p style="margin-left: 30px">css</p>
```
--button-primary-color: #009688; // 主题色
--button-border-radius: 2px; // 圆角
--button-border-color: #d2d2d2; // 边框色
``` ```
::: title Button 属性 ::: title Button 属性

View File

@ -30,6 +30,27 @@ export default {
::: :::
::: title 主题配置
:::
<p style="margin-left: 30px">less</p>
```
@panel-border-color: #eee;
@panel-border-radius: 2px;
@panel-fore-color: #333;
@panel-back-color: #fff;
```
<p style="margin-left: 30px">css</p>
```
--panel-border-color: #eee;
--panel-border-radius: 2px;
--panel-fore-color: #333;
--panel-back-color: #fff;
```
::: title Panel 插槽 ::: title Panel 插槽
::: :::

View File

@ -2,10 +2,12 @@
@button-primary-color: var(--button-primary-color); @button-primary-color: var(--button-primary-color);
@button-border-radius: var(--button-border-radius); @button-border-radius: var(--button-border-radius);
@button-border-color: var(--button-border-color);
:root { :root {
--button-primary-color: @global-primary-color; --button-primary-color: @global-primary-color;
--button-border-radius: @global-border-radius; --button-border-radius: @global-border-radius;
--button-border-color: #d2d2d2;
} }
.layui-btn { .layui-btn {
@ -48,7 +50,7 @@
} }
.layui-btn-primary { .layui-btn-primary {
border-color: #d2d2d2; border-color: @global-border-color;
background: 0 0; background: 0 0;
color: #666; color: #666;
} }

View File

@ -1,16 +1,26 @@
@import "../../theme/variable.less"; @import "../../theme/variable.less";
@card-border-radius: var(--card-border-radius);
@card-back-color: var(--card-back-color);
@card-fore-color: var(--card-fore-color);
:root {
--card-border-radius: @global-border-radius;
--card-back-color: @global-back-color;
--card-fore-color: @global-fore-color;
}
.layui-card { .layui-card {
margin-bottom: 15px; margin-bottom: 15px;
border-radius: @global-border-radius; border-radius: @card-border-radius;
background-color: #fff; background-color: @card-back-color;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
.layui-card-header { .layui-card-header {
height: 42px; height: 42px;
line-height: 42px; line-height: 42px;
padding: 0 15px; padding: 0 15px;
border-bottom: 1px solid #f6f6f6; border-bottom: 1px solid #f6f6f6;
color: #333; color: @card-fore-color;
font-size: 14px; font-size: 14px;
} }
.layui-card-body { .layui-card-body {

View File

@ -0,0 +1,36 @@
@import "../../theme/variable.less";
@input-border-radius: var(--input-border-radius);
@input-border-color: var(--input-border-color);
:root {
--input-border-radius: @global-border-radius;
--input-border-color: @global-border-color;
}
.layui-input {
height: 38px;
line-height: 1.3;
line-height: 38px\9;
border-width: 1px;
border-style: solid;
background-color: #fff;
color: rgba(0, 0, 0, 0.85);
border-radius: @input-border-radius;
border-color: @input-border-color;
display: block;
width: 100%;
padding-left: 10px;
}
.layui-input:hover {
border-color: #eee !important;
}
.layui-input:focus {
border-color: #d2d2d2 !important;
}
.layui-input::-webkit-input-placeholder {
line-height: 1.3;
}

View File

@ -5,6 +5,8 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import "./index.less"
export interface LayInputProps { export interface LayInputProps {
name?: string; name?: string;
type?: string; type?: string;

View File

@ -1,9 +1,23 @@
@import "../../theme/variable.less"; @import "../../theme/variable.less";
@panel-border-color: var(--panel-border-color);
@panel-border-radius: var(--panel-border-radius);
@panel-fore-color: var(--panel-fore-color);
@panel-back-color: var(--panel-back-color);
:root {
--panel-border-color: @global-border-color;
--panel-border-radius: @global-border-radius;
--panel-fore-color: @global-fore-color;
--panel-back-color: @global-back-color;
}
.layui-panel { .layui-panel {
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
border-radius: @global-border-radius; border-radius: @panel-border-radius;
background-color: #fff; border-color: @panel-border-color;
color: #666; background-color: @panel-back-color;
color: @panel-fore-color;
} }

View File

@ -0,0 +1,37 @@
@import "../../theme/variable.less";
@textarea-border-radius: var(--textarea-border-radius);
@textarea-border-color: var(--textarea-border-color);
:root {
--textarea-border-radius: @global-border-radius;
--textarea-border-color: @global-border-color;
}
.layui-textarea {
border-width: 1px;
border-style: solid;
background-color: #fff;
color: rgba(0, 0, 0, 0.85);
border-radius: @textarea-border-radius;
border-color: @textarea-border-color;
display: block;
width: 100%;
height: auto;
line-height: 20px;
min-height: 100px;
padding: 6px 10px;
resize: vertical;
}
.layui-textarea:hover {
border-color: #eee !important;
}
.layui-textarea:focus {
border-color: #d2d2d2 !important;
}
.layui-textarea::-webkit-input-placeholder {
line-height: 1.3;
}

View File

@ -5,6 +5,8 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import "./index.less";
export interface LayTextareaProps { export interface LayTextareaProps {
name?: string; name?: string;
modelValue?: string; modelValue?: string;

View File

@ -515,18 +515,15 @@ a cite {
.layui-form-pane .layui-form-label, .layui-form-pane .layui-form-label,
.layui-iconpicker, .layui-iconpicker,
.layui-iconpicker-main, .layui-iconpicker-main,
.layui-input,
.layui-input-split, .layui-input-split,
.layui-layedit, .layui-layedit,
.layui-layedit-tool, .layui-layedit-tool,
.layui-panel,
.layui-quote-nm, .layui-quote-nm,
.layui-select, .layui-select,
.layui-tab-bar, .layui-tab-bar,
.layui-tab-card, .layui-tab-card,
.layui-tab-title, .layui-tab-title,
.layui-tab-title .layui-this:after, .layui-tab-title .layui-this:after {
.layui-textarea {
border-color: #eee; border-color: #eee;
} }
@ -694,9 +691,7 @@ a cite {
-webkit-appearance: none; -webkit-appearance: none;
} }
.layui-input, .layui-select {
.layui-select,
.layui-textarea {
height: 38px; height: 38px;
line-height: 1.3; line-height: 1.3;
line-height: 38px\9; line-height: 38px\9;
@ -707,37 +702,10 @@ a cite {
border-radius: @global-border-radius; border-radius: @global-border-radius;
} }
.layui-input::-webkit-input-placeholder, .layui-select::-webkit-input-placeholder {
.layui-select::-webkit-input-placeholder,
.layui-textarea::-webkit-input-placeholder {
line-height: 1.3; line-height: 1.3;
} }
.layui-input,
.layui-textarea {
display: block;
width: 100%;
padding-left: 10px;
}
.layui-input:hover,
.layui-textarea:hover {
border-color: #eee !important;
}
.layui-input:focus,
.layui-textarea:focus {
border-color: #d2d2d2 !important;
}
.layui-textarea {
min-height: 100px;
height: auto;
line-height: 20px;
padding: 6px 10px;
resize: vertical;
}
.layui-select { .layui-select {
padding: 0 10px; padding: 0 10px;
} }

View File

@ -4,6 +4,8 @@
@global-border-radius: var(--global-border-radius); @global-border-radius: var(--global-border-radius);
@global-border-color: var(--global-border-color);
@global-fore-color: var(--global-fore-color); @global-fore-color: var(--global-fore-color);
@global-back-color: var(--global-back-color); @global-back-color: var(--global-back-color);
@ -14,9 +16,11 @@
--global-checked-color: #5fb878; --global-checked-color: #5fb878;
--global-border-color: #eee;
--global-border-radius: 2px; --global-border-radius: 2px;
--global-fore-color: #393d49; --global-fore-color: #333;
--global-back-color: #ffffff; --global-back-color: #ffffff;
@ -24,7 +28,10 @@
body[lay-theme='dark'] { body[lay-theme='dark'] {
--global-border-color: #d2d2d2;
--global-fore-color: #ffffff; --global-fore-color: #ffffff;
--global-back-color: #393d49; --global-back-color: #393d49;
} }