🐛(layer): typescript 错误
更新文档
This commit is contained in:
parent
04b52e0814
commit
f030784410
@ -108,7 +108,13 @@ const handleClick = function () {
|
|||||||
:lay-skin="skin"
|
:lay-skin="skin"
|
||||||
>
|
>
|
||||||
<span v-if="$slots?.default"><slot></slot></span>
|
<span v-if="$slots?.default"><slot></slot></span>
|
||||||
<lay-icon :type="props.isIndeterminate && isChecked ? 'layui-icon-subtraction' : 'layui-icon-ok'"></lay-icon>
|
<lay-icon
|
||||||
|
:type="
|
||||||
|
props.isIndeterminate && isChecked
|
||||||
|
? 'layui-icon-subtraction'
|
||||||
|
: 'layui-icon-ok'
|
||||||
|
"
|
||||||
|
></lay-icon>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { computed, VNodeTypes } from 'vue';
|
||||||
export default {
|
export default {
|
||||||
name: "Iframe",
|
name: "Iframe",
|
||||||
};
|
};
|
||||||
@ -6,10 +7,15 @@ export default {
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
export interface IframeProps {
|
export interface IframeProps {
|
||||||
src: string;
|
src?: string | Function | object | VNodeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<IframeProps>();
|
const props = defineProps<IframeProps>();
|
||||||
|
|
||||||
|
const src = computed(() => {
|
||||||
|
return props.src as string
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -5,19 +5,19 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineEmits } from "vue";
|
import { computed, defineEmits, StyleValue } from "vue";
|
||||||
|
|
||||||
const emit = defineEmits(["shadeClick"]);
|
|
||||||
|
|
||||||
export interface ShadeProps {
|
export interface ShadeProps {
|
||||||
index: number;
|
|
||||||
opacity: string;
|
opacity: string;
|
||||||
visible: boolean;
|
index: number | Function;
|
||||||
|
visible: boolean | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<ShadeProps>();
|
const props = defineProps<ShadeProps>();
|
||||||
|
|
||||||
const styles = computed(() => {
|
const emit = defineEmits(["shadeClick"]);
|
||||||
|
|
||||||
|
const styles = computed<any>(() => {
|
||||||
return {
|
return {
|
||||||
opacity: props.opacity,
|
opacity: props.opacity,
|
||||||
zIndex: props.index,
|
zIndex: props.index,
|
||||||
|
@ -6,7 +6,7 @@ export default {
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
export interface HeaderProps {
|
export interface HeaderProps {
|
||||||
title: string;
|
title: string | boolean | Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderContent = function (content: any) {
|
const renderContent = function (content: any) {
|
||||||
|
@ -10,40 +10,14 @@ import Iframe from "./Iframe.vue";
|
|||||||
import Title from "./Title.vue";
|
import Title from "./Title.vue";
|
||||||
import CloseBtn from "./CloseBtn.vue";
|
import CloseBtn from "./CloseBtn.vue";
|
||||||
import Resize from "./Resize.vue";
|
import Resize from "./Resize.vue";
|
||||||
import {
|
import { Ref, ref, watch, computed, useSlots, VNodeTypes, nextTick, inject } from "vue";
|
||||||
Ref,
|
import { nextId, maxArea, maxOffset, getArea, calculateArea, calculateOffset, calculateContent, calculateType, minArea, minOffset, updateMinArrays, getDrawerAnimationClass, calculateDrawerArea } from "../utils";
|
||||||
ref,
|
|
||||||
watch,
|
|
||||||
computed,
|
|
||||||
useSlots,
|
|
||||||
VNodeTypes,
|
|
||||||
nextTick,
|
|
||||||
inject,
|
|
||||||
} from "vue";
|
|
||||||
import {
|
|
||||||
nextId,
|
|
||||||
maxArea,
|
|
||||||
maxOffset,
|
|
||||||
getArea,
|
|
||||||
calculateArea,
|
|
||||||
calculateOffset,
|
|
||||||
calculateContent,
|
|
||||||
calculateType,
|
|
||||||
minArea,
|
|
||||||
minOffset,
|
|
||||||
updateMinArrays,
|
|
||||||
getDrawerAnimationClass,
|
|
||||||
calculateDrawerArea,
|
|
||||||
} from "../utils";
|
|
||||||
import useMove from "../composable/useMove";
|
import useMove from "../composable/useMove";
|
||||||
import useResize from "../composable/useResize";
|
import useResize from "../composable/useResize";
|
||||||
import { zIndexKey } from "../tokens";
|
import { zIndexKey } from "../tokens";
|
||||||
|
|
||||||
const slots = useSlots();
|
|
||||||
const layero = ref<HTMLElement | null>(null);
|
|
||||||
const emit = defineEmits(["close", "update:modelValue"]);
|
|
||||||
|
|
||||||
export interface LayModalProps {
|
export interface LayModalProps {
|
||||||
|
domId?: string;
|
||||||
title?: string | boolean | Function;
|
title?: string | boolean | Function;
|
||||||
icon?: string | number;
|
icon?: string | number;
|
||||||
skin?: string;
|
skin?: string;
|
||||||
@ -53,7 +27,7 @@ export interface LayModalProps {
|
|||||||
area?: string[] | "auto";
|
area?: string[] | "auto";
|
||||||
modelValue?: boolean;
|
modelValue?: boolean;
|
||||||
maxmin?: boolean | string;
|
maxmin?: boolean | string;
|
||||||
btn?: Record<string, unknown>[] | false;
|
btn?: Record<string, Function>[] | false;
|
||||||
move?: boolean | string;
|
move?: boolean | string;
|
||||||
resize?: boolean | string;
|
resize?: boolean | string;
|
||||||
type?: 0 | 1 | 2 | 3 | "dialog" | "page" | "iframe" | "loading" | "drawer";
|
type?: 0 | 1 | 2 | 3 | "dialog" | "page" | "iframe" | "loading" | "drawer";
|
||||||
@ -79,7 +53,8 @@ export interface LayModalProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayModalProps>(), {
|
const props = withDefaults(defineProps<LayModalProps>(), {
|
||||||
title: "信息",
|
domId: '',
|
||||||
|
title: "标题",
|
||||||
setTop: false,
|
setTop: false,
|
||||||
offset: () => ["50%", "50%"],
|
offset: () => ["50%", "50%"],
|
||||||
area: "auto",
|
area: "auto",
|
||||||
@ -106,22 +81,18 @@ const props = withDefaults(defineProps<LayModalProps>(), {
|
|||||||
isMessage: false,
|
isMessage: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const id: Ref<string> = ref(nextId());
|
const emit = defineEmits(["close", "update:modelValue"]);
|
||||||
|
|
||||||
|
const slots = useSlots();
|
||||||
const max: Ref<boolean> = ref(false);
|
const max: Ref<boolean> = ref(false);
|
||||||
const min: Ref<boolean> = ref(false);
|
const min: Ref<boolean> = ref(false);
|
||||||
|
const id: Ref<string> = ref(nextId());
|
||||||
|
const layero = ref<HTMLElement | null>(null);
|
||||||
const type: number = calculateType(props.type);
|
const type: number = calculateType(props.type);
|
||||||
const area: Ref<string[]> = ref(
|
const area: Ref<string[]> = ref(calculateArea(props.type, props.area, props.offset));
|
||||||
calculateArea(props.type, props.area, props.offset)
|
const offset: Ref<string[]> = ref(calculateOffset(props.offset, area.value, props.type));
|
||||||
);
|
const contentHeight = ref(calculateContent(area.value[1], props.btn, type, props.isMessage));
|
||||||
const offset: Ref<string[]> = ref(
|
const index: Ref<number | Function> = ref(props.zIndex ?? inject(zIndexKey, 99999));
|
||||||
calculateOffset(props.offset, area.value, props.type)
|
|
||||||
);
|
|
||||||
const contentHeight = ref(
|
|
||||||
calculateContent(area.value[1], props.btn, type, props.isMessage)
|
|
||||||
);
|
|
||||||
const index: Ref<number | Function> = ref(
|
|
||||||
props.zIndex ?? inject(zIndexKey, 99999)
|
|
||||||
);
|
|
||||||
const visible: Ref<boolean> = ref(false);
|
const visible: Ref<boolean> = ref(false);
|
||||||
const first: Ref<boolean> = ref(true);
|
const first: Ref<boolean> = ref(true);
|
||||||
|
|
||||||
@ -146,17 +117,14 @@ const firstOpenDelayCalculation = function () {
|
|||||||
area.value = calculateDrawerArea(props.offset, props.area);
|
area.value = calculateDrawerArea(props.offset, props.area);
|
||||||
}
|
}
|
||||||
offset.value = calculateOffset(props.offset, area.value, props.type);
|
offset.value = calculateOffset(props.offset, area.value, props.type);
|
||||||
|
|
||||||
w.value = area.value[0];
|
w.value = area.value[0];
|
||||||
h.value = area.value[1];
|
h.value = area.value[1];
|
||||||
t.value = offset.value[0];
|
t.value = offset.value[0];
|
||||||
l.value = offset.value[1];
|
l.value = offset.value[1];
|
||||||
|
|
||||||
_w.value = area.value[0];
|
_w.value = area.value[0];
|
||||||
_l.value = area.value[1];
|
_l.value = area.value[1];
|
||||||
_t.value = offset.value[0];
|
_t.value = offset.value[0];
|
||||||
_l.value = offset.value[1];
|
_l.value = offset.value[1];
|
||||||
|
|
||||||
supportMove();
|
supportMove();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -367,7 +335,7 @@ const supportMove = function () {
|
|||||||
* 弹层样式
|
* 弹层样式
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
const styles = computed(() => {
|
const styles = computed<any>(() => {
|
||||||
return {
|
return {
|
||||||
top: t.value,
|
top: t.value,
|
||||||
left: l.value,
|
left: l.value,
|
||||||
|
@ -1 +1 @@
|
|||||||
export const zIndexKey = Symbol("zIndex");
|
export const zIndexKey = Symbol("zIndex");
|
@ -1,3 +1,3 @@
|
|||||||
export type StringObject = Record<string, unknown>;
|
export type StringObject = Record<string, unknown>;
|
||||||
|
|
||||||
export interface InstallOptions extends StringObject {}
|
export interface InstallOptions extends StringObject {}
|
Loading…
Reference in New Issue
Block a user