perf(checkbox): 删除 customChecked 内置逻辑

This commit is contained in:
就眠仪式
2021-10-13 21:43:23 +08:00
parent 6769048cd2
commit e5f53064a3
6 changed files with 35 additions and 32 deletions

View File

@@ -4921,6 +4921,10 @@ body .layui-table-tips .layui-layer-content {
font-size: 14px;
}
.layui-breadcrumb a {
color: #999;
}
.layui-breadcrumb a:hover {
color: #5fb878 !important;
}

View File

@@ -1,14 +1,11 @@
<template>
<span class="layui-breadcrumb" style="visibility: visible">
<slot />
<slot></slot>
</span>
</template>
<script setup name="LayBreadcrumb" lang="ts">
import { defineProps, provide, withDefaults, useSlots } from 'vue'
const slot = useSlots()
const slots = slot.default && slot.default()
import { defineProps, provide, withDefaults, useSlots, ref, Ref } from 'vue'
const props = withDefaults(
defineProps<{

View File

@@ -1,6 +1,6 @@
<template>
<a href="javascript:void(0)">{{ title }}</a>
<span lay-separator="">{{ separator }}</span>
<a href>{{ title }}</a>
<span lay-separator>{{ separator }}</span>
</template>
<script setup name="LayBreadcrumbItem" lang="ts">

View File

@@ -5,7 +5,7 @@
class="layui-unselect layui-form-checkbox"
:class="{
'layui-checkbox-disbaled layui-disabled': disabled,
'layui-form-checked': needCustomChecked ? customChecked : props.checked,
'layui-form-checked': props.checked,
}"
:lay-skin="skin"
>
@@ -27,20 +27,12 @@ const props =
disabled?: boolean
}>()
const customChecked = ref(false)
const needCustomChecked = props.checked == undefined
const emit = defineEmits(['update:checked', 'change'])
const handleClick = function () {
if (!props.disabled) {
if (needCustomChecked) {
customChecked.value = !customChecked.value
emit('change', !customChecked.value)
} else {
emit('update:checked', !props.checked)
emit('change', !props.checked)
}
}
}
</script>

View File

@@ -20,8 +20,8 @@ const props = withDefaults(
defineProps<{
modelValue: boolean
disabled?: boolean
activeText: string
inactiveText: string
activeText?: string
inactiveText?: string
}>(),
{
activeText: '启用',