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