(date-picker): 针对 datepicker 组件 btn 样式的缝缝补补

This commit is contained in:
就眠儀式 2022-11-14 14:27:39 +08:00
parent 1de4e93d6d
commit b079bdb646
6 changed files with 84 additions and 31 deletions

View File

@ -18,7 +18,8 @@
:key="item"
:class="{
'layui-this': MONTH_NAME.indexOf(item) === Month,
'layui-laydate-current':Month===''&&parseInt(item)-1===dayjs().month()
'layui-laydate-current':
Month === '' && parseInt(item) - 1 === dayjs().month(),
}"
@click="handleMonthClick(item)"
>

View File

@ -36,7 +36,9 @@
'laydate-range-hover': ifHasRangeHoverClass(
getUnix(item, 'left')
),
'layui-laydate-current':(startTime.unix === -1 || endTime.unix === -1)&&getUnix(item, 'left')===dayjs().startOf('month').valueOf()
'layui-laydate-current':
(startTime.unix === -1 || endTime.unix === -1) &&
getUnix(item, 'left') === dayjs().startOf('month').valueOf(),
}"
@click="handleMonthClick(getUnix(item, 'left'))"
@mouseenter="monthItemMouseEnter($event, item)"
@ -81,7 +83,9 @@
'laydate-range-hover': ifHasRangeHoverClass(
getUnix(item, 'right')
),
'layui-laydate-current':(startTime.unix === -1 || endTime.unix === -1)&&getUnix(item, 'right')===dayjs().startOf('month').valueOf()
'layui-laydate-current':
(startTime.unix === -1 || endTime.unix === -1) &&
getUnix(item, 'right') === dayjs().startOf('month').valueOf(),
}"
@click="handleMonthClick(getUnix(item, 'right'))"
@mouseenter="monthItemMouseEnter($event, item)"

View File

@ -20,7 +20,7 @@
:key="item"
:class="{
'layui-this': Year === item,
'layui-laydate-current':!Year&&item===dayjs().year()
'layui-laydate-current': !Year && item === dayjs().year(),
}"
@click="handleYearClick(item)"
>

View File

@ -27,7 +27,9 @@
(item.value == startDate || item.value == endDate)),
'laydate-range-hover': ifHasRangeHoverClass(item),
'layui-disabled': item.type !== 'current' && datePicker.range,
'layui-laydate-current':modelValue===-1&&item.value===dayjs().startOf('day').valueOf()
'layui-laydate-current':
modelValue === -1 &&
item.value === dayjs().startOf('day').valueOf(),
}"
@click="handleDayClick(item)"
@mouseenter="dayItemMouseEnter($event, item)"

View File

@ -248,6 +248,7 @@ html #layuicss-laydate {
line-height: 26px;
padding: 10px;
}
.layui-laydate-footer span {
display: inline-block;
vertical-align: top;
@ -272,27 +273,32 @@ html #layuicss-laydate {
border-bottom-right-radius: 2px;
}
.layui-laydate-footer span:not(:last-child) {
border-right: none;
}
.layui-laydate-footer span:hover {
color: #5fb878;
}
.layui-laydate-footer span.layui-laydate-preview {
cursor: default;
border-color: transparent !important;
}
.layui-laydate-footer span.layui-laydate-preview:hover {
color: #666;
}
.layui-laydate-footer span:first-child.layui-laydate-preview {
padding-left: 0;
}
.laydate-footer-btns {
position: absolute;
right: 10px;
top: 10px;
}
.laydate-footer-btns span {
margin: 0 0 0 -1px;
}
/* 年月列表 */
.layui-laydate-list {

View File

@ -17,7 +17,7 @@ import {
ref,
useSlots,
withDefaults,
watch
watch,
} from "vue";
import { templateRef } from "@vueuse/core";
import { LayLayer } from "@layui/layer-vue";
@ -265,7 +265,7 @@ const errorF = (errorText: string) => {
let errorMsg = errorText ? errorText : defaultErrorMsg;
errorMsg = `layui-vue:${errorMsg}`;
console.warn(errorMsg);
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) { });
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) {});
emit("error", Object.assign({ currentTimeStamp, msg: errorMsg }));
};
@ -442,9 +442,22 @@ onUnmounted(() => {
</script>
<template>
<div class="layui-upload layui-upload-wrap" :class="disabledPreview ? 'layui-upload-file-disabled' : ''">
<input type="file" class="layui-upload-file" ref="orgFileInput" :name="field" :field="field" :multiple="multiple"
:accept="acceptMime" :disabled="disabled" @click="clickOrgInput" @change="uploadChange" />
<div
class="layui-upload layui-upload-wrap"
:class="disabledPreview ? 'layui-upload-file-disabled' : ''"
>
<input
type="file"
class="layui-upload-file"
ref="orgFileInput"
:name="field"
:field="field"
:multiple="multiple"
:accept="acceptMime"
:disabled="disabled"
@click="clickOrgInput"
@change="uploadChange"
/>
<div v-if="!drag">
<div class="layui-upload-btn-box" @click.stop="chooseFile">
<template v-if="slot.default">
@ -457,13 +470,19 @@ onUnmounted(() => {
</template>
</div>
</div>
<div v-else ref="dragRef" class="layui-upload-drag" :class="
<div
v-else
ref="dragRef"
class="layui-upload-drag"
:class="
disabled
? 'layui-upload-drag-disable'
: isDragEnter
? 'layui-upload-drag-draging'
: ''
" @click.stop="chooseFile">
"
@click.stop="chooseFile"
>
<i class="layui-icon"></i>
<p>{{ dragText }}</p>
<div class="layui-hide" id="uploadDemoView">
@ -471,17 +490,38 @@ onUnmounted(() => {
<img src="" alt="上传成功后渲染" style="max-width: 196px" />
</div>
</div>
<lay-layer v-model="innerCutVisible" :title="computedCutLayerOption.title" :move="computedCutLayerOption.move"
:resize="computedCutLayerOption.resize" :shade="computedCutLayerOption.shade"
:shadeClose="computedCutLayerOption.shadeClose" :shadeOpacity="computedCutLayerOption.shadeOpacity"
:zIndex="computedCutLayerOption.zIndex" :btnAlign="computedCutLayerOption.btnAlign"
:area="computedCutLayerOption.area" :anim="computedCutLayerOption.anim"
:isOutAnim="computedCutLayerOption.isOutAnim" :btn="computedCutLayerOption.btn" @close="clearAllCutEffect">
<div class="copper-container" v-for="(base64str, index) in activeUploadFilesImgs" :key="`file${index}`">
<img :src="base64str" :id="`_lay_upload_img${index}`" class="_lay_upload_img" />
<lay-layer
v-model="innerCutVisible"
:title="computedCutLayerOption.title"
:move="computedCutLayerOption.move"
:resize="computedCutLayerOption.resize"
:shade="computedCutLayerOption.shade"
:shadeClose="computedCutLayerOption.shadeClose"
:shadeOpacity="computedCutLayerOption.shadeOpacity"
:zIndex="computedCutLayerOption.zIndex"
:btnAlign="computedCutLayerOption.btnAlign"
:area="computedCutLayerOption.area"
:anim="computedCutLayerOption.anim"
:isOutAnim="computedCutLayerOption.isOutAnim"
:btn="computedCutLayerOption.btn"
@close="clearAllCutEffect"
>
<div
class="copper-container"
v-for="(base64str, index) in activeUploadFilesImgs"
:key="`file${index}`"
>
<img
:src="base64str"
:id="`_lay_upload_img${index}`"
class="_lay_upload_img"
/>
</div>
</lay-layer>
<div class="layui-upload-list" :class="disabledPreview ? 'layui-upload-list-disabled' : ''">
<div
class="layui-upload-list"
:class="disabledPreview ? 'layui-upload-list-disabled' : ''"
>
<slot name="preview"></slot>
</div>
</div>