🐛(component): 修复 ident 属性带来的 typescript 警告
This commit is contained in:
parent
a2bcc81db5
commit
3de170d454
@ -3,10 +3,11 @@ export function indentHandle(obj: {
|
||||
indent: boolean | string;
|
||||
level: number;
|
||||
basePadding?: number;
|
||||
isTree?: boolean;
|
||||
}) {
|
||||
const { indent, level, basePadding = 0 } = obj;
|
||||
const { indent, level, basePadding = 0, isTree } = obj;
|
||||
const least: number = level - 1; // 第一层不缩进
|
||||
if (indent && least > 0) {
|
||||
if (isTree && indent && least > 0) {
|
||||
const px =
|
||||
typeof indent === "boolean"
|
||||
? `${basePadding + 10 * least}px` // css样式表对<a>设定了23基础边距
|
||||
|
@ -46,7 +46,7 @@ const needTooltip = computed(
|
||||
<li
|
||||
class="layui-nav-item"
|
||||
:class="[selectedKey === id ? 'layui-this' : '']"
|
||||
:style="isTree && indentHandle({ indent, level })"
|
||||
:style="indentHandle({ indent, level, isTree })"
|
||||
@click="selectHandle()"
|
||||
>
|
||||
<template v-if="needTooltip">
|
||||
|
@ -75,13 +75,7 @@ const openHandle = function () {
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
@click="openHandle()"
|
||||
:style="
|
||||
indentHandle({
|
||||
indent,
|
||||
level,
|
||||
basePadding: 23,
|
||||
})
|
||||
"
|
||||
:style="indentHandle({indent,level,basePadding: 23,isTree})"
|
||||
>
|
||||
<!-- 图标 -->
|
||||
<i v-if="slots.icon" class="layui-sub-menu-icon">
|
||||
|
@ -130,7 +130,14 @@ const props = withDefaults(defineProps<LayUploadProps>(), {
|
||||
const slot = useSlots();
|
||||
const slots = slot.default && slot.default();
|
||||
const context = getCurrentInstance();
|
||||
const emit = defineEmits(["choose","before","done","error","cutdone","cutcancel"]);
|
||||
const emit = defineEmits([
|
||||
"choose",
|
||||
"before",
|
||||
"done",
|
||||
"error",
|
||||
"cutdone",
|
||||
"cutcancel",
|
||||
]);
|
||||
|
||||
const isDragEnter = ref(false);
|
||||
const activeUploadFiles = ref<any[]>([]);
|
||||
@ -140,7 +147,7 @@ let _cropper: any = null;
|
||||
|
||||
let computedCutLayerOption: ComputedRef<LayerModal>;
|
||||
|
||||
if (props.cutOptions && props.cutOptions.layerOption) {
|
||||
if (props.cutOptions && props.cutOptions.layerOption) {
|
||||
computedCutLayerOption = computed(() =>
|
||||
Object.assign(defaultCutLayerOption, props.cutOptions.layerOption)
|
||||
);
|
||||
@ -227,13 +234,24 @@ const localUpload = (option: localUploadOption, callback: Function) => {
|
||||
xhr.onreadystatechange = function () {
|
||||
let currentTimeStamp = new Date().valueOf();
|
||||
if (xhr.readyState === 1) {
|
||||
if ((xhr.status >= 200 && xhr.status <= 300) || xhr.status === 304 || xhr.status == 0) {
|
||||
if (
|
||||
(xhr.status >= 200 && xhr.status <= 300) ||
|
||||
xhr.status === 304 ||
|
||||
xhr.status == 0
|
||||
) {
|
||||
let successText = "上传开始";
|
||||
emit("before",Object.assign({ currentTimeStamp, msg: successText, ...option }));
|
||||
emit(
|
||||
"before",
|
||||
Object.assign({ currentTimeStamp, msg: successText, ...option })
|
||||
);
|
||||
}
|
||||
} else if (xhr.readyState === 4) {
|
||||
let successText = xhr.responseText ? xhr.responseText : uploadSuccess;
|
||||
if ((xhr.status >= 200 && xhr.status <= 300) || xhr.status === 304 || xhr.status == 0) {
|
||||
if (
|
||||
(xhr.status >= 200 && xhr.status <= 300) ||
|
||||
xhr.status === 304 ||
|
||||
xhr.status == 0
|
||||
) {
|
||||
let data = xhr.responseText;
|
||||
emit("done", { currentTimeStamp, msg: successText, data: data });
|
||||
}
|
||||
@ -349,23 +367,23 @@ const clickOrgInput = () => {
|
||||
|
||||
const dragRef = ref();
|
||||
|
||||
function dragEnter(e: any){
|
||||
function dragEnter(e: any) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function dragOver(e: any){
|
||||
function dragOver(e: any) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
dragRef.value.addEventListener("dragenter",dragEnter,false);
|
||||
dragRef.value.addEventListener("dragover",dragOver,false);
|
||||
dragRef.value.addEventListener("drop",uploadChange,false);
|
||||
})
|
||||
})
|
||||
dragRef.value.addEventListener("dragenter", dragEnter, false);
|
||||
dragRef.value.addEventListener("dragover", dragOver, false);
|
||||
dragRef.value.addEventListener("drop", uploadChange, false);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -399,7 +417,13 @@ onMounted(() => {
|
||||
v-else
|
||||
ref="dragRef"
|
||||
class="layui-upload-drag"
|
||||
:class="disabled ? 'layui-upload-drag-disable' : isDragEnter ? 'layui-upload-drag-draging' : ''"
|
||||
:class="
|
||||
disabled
|
||||
? 'layui-upload-drag-disable'
|
||||
: isDragEnter
|
||||
? 'layui-upload-drag-draging'
|
||||
: ''
|
||||
"
|
||||
@click.stop="chooseFile"
|
||||
>
|
||||
<i class="layui-icon"></i>
|
||||
|
@ -80,7 +80,7 @@ export default {
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-menu :selected-key="selectedKey" @change-selected-Key="changeSelectedKey" :indent="true" @change-open-keys="changeOpenKeys" v-model:openKeys="openKeys2" :tree="true">
|
||||
<lay-menu :selected-key="selectedKey" @change-selected-Key="changeSelectedKey" @change-open-keys="changeOpenKeys" v-model:openKeys="openKeys2" :tree="true">
|
||||
<lay-menu-item id="1">首页</lay-menu-item>
|
||||
<lay-menu-item id="2">首页</lay-menu-item>
|
||||
<lay-menu-item id="3">首页</lay-menu-item>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<li>
|
||||
<h3>1.6.7 <span class="layui-badge-rim">2022-10-12</span></h3>
|
||||
<ul>
|
||||
<li>优化菜单的问题</li>
|
||||
<li>[修复] tansfer 组件 data-source 属性缺少响应式的特性。</li>
|
||||
<li>[修复] upload 组件 drag 属性开启后, 拖拽上传无效的问题。</li>
|
||||
<li>[优化] switch 组件 on-switch-text 和 un-switch-text 属性, 为描述提供适当边距。</li>
|
||||
|
Loading…
Reference in New Issue
Block a user