feat: add switch onswitch-icon and unswitch-icon slot

This commit is contained in:
就眠儀式
2022-03-24 04:23:24 +08:00
parent 5df0a0dea6
commit ce356012ce
9 changed files with 50 additions and 27 deletions

View File

@@ -14,7 +14,7 @@
transition: 0.1s linear;
}
.layui-form-switch i {
.layui-form-switch span {
position: absolute;
left: 5px;
top: 3px;
@@ -43,7 +43,7 @@
background-color: @global-checked-color;
}
.layui-form-onswitch i {
.layui-form-onswitch span {
left: 100%;
margin-left: -21px;
background-color: #fff;

View File

@@ -51,7 +51,12 @@ const handleClick = function () {
}"
>
<em>{{ isActive == true ? activeText : inactiveText }}</em>
<i></i>
<span>
<div>
<slot v-if="isActive" name="onswitch-icon"></slot>
<slot v-else name="unswitch-icon"></slot>
</div>
</span>
</div>
</span>
</template>