补充部分组件描述

This commit is contained in:
就眠儀式 2022-02-06 03:19:24 +08:00
parent a74c559fdd
commit 6e568f2d2f
94 changed files with 352 additions and 259 deletions

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 在实用价值的前提之下,我们并没有内置过多花俏的动画。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 按钮用于开始一个即时操作。
:::
::: title 基础使用 ::: title 基础使用
::: :::
@ -206,7 +212,7 @@ export default {
::: title 按钮容器 ::: title 按钮容器
::: :::
::: demo 使用 `lay-button-container` 标签, 创建一个按钮容器 ::: demo 尽管按钮在同节点并排时会自动拉开间距,但在按钮太多的情况,效果并不是很美好。因为你需要用到按钮容器
<template> <template>
<lay-button-container> <lay-button-container>

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 视觉疲劳的形成往往是由于颜色过于丰富或过于单一形成的麻木感。
:::
::: title 主色调 ::: title 主色调
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 栅格化系统是基于行row和列col来定义区块的外部框架以保证页面的元素能够稳健地排布起来。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 语义化的矢量图形。使用图标组件,你需要安装 `@layui/icons-vue` 图标组件包
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 通过鼠标或键盘输入内容,是最基础的表单域的包装。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 既可编织出绚丽的前台页面,又可满足繁杂的管理系统界面需求。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,10 +1,15 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 在需要等待加载内容的位置提供一个占位图形组合。
:::
::: title 基础使用 ::: title 基础使用
::: :::
::: demo 使用 `lay-skeleton` 标签, 创建骨架屏 ::: demo 使用 `lay-skeleton` 标签, 创建骨架屏
<template> <template>

View File

@ -4,7 +4,6 @@
::: title 基础使用 ::: title 基础使用
::: :::
::: demo ::: demo
<template> <template>

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 开关选择器, 需要表示开关状态/两种状态之间的切换时。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -1,6 +1,12 @@
::: anchor ::: anchor
::: :::
::: title 基本介绍
:::
::: describe 将时间抽象到二维平面,垂直呈现一段从过去到现在的故事。
:::
::: title 基础使用 ::: title 基础使用
::: :::

View File

@ -4,13 +4,11 @@
``` ```
npm install @layui/layui-vue --save npm install @layui/layui-vue --save
``` ```
:::describe 或
:::
``` ```
yarn add @layui/layui-vue --save yarn add @layui/layui-vue --save
``` ```
:::describe 或
:::
``` ```
pnpm install @layui/layui-vue --save pnpm install @layui/layui-vue --save
``` ```

View File

@ -18,7 +18,7 @@ export default function createContainer(
const token = tokens[idx] const token = tokens[idx]
const info = token.info.trim().slice(klass.length).trim() const info = token.info.trim().slice(klass.length).trim()
if (token.nesting === 1) { if (token.nesting === 1) {
return `<p style="margin-left: 24px;margin-bottom:20px;">${info}` return `<p style="padding-left: 30px;padding-top: 20px;padding-bottom: 20px;">${info}`
} else { } else {
return '</p>\n' return '</p>\n'
} }

View File

@ -7,11 +7,13 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import "./index.less"; import "./index.less";
const props = defineProps<{ export interface LayAvatarProps {
src?: String; src?: String;
size?: string; size?: string;
radius?: boolean; radius?: boolean;
}>(); }
const props = withDefaults(defineProps<LayAvatarProps>(), {});
</script> </script>
<template> <template>

View File

@ -16,11 +16,9 @@ import LayIcon from "../icon/index";
import "./index.less"; import "./index.less";
export interface LayBacktopProps { export interface LayBacktopProps {
/**通用*/
target?: string; target?: string;
showHeight?: number; showHeight?: number;
disabled?: boolean; disabled?: boolean;
/**组件样式*/
position?: "fixed" | "absolute"; position?: "fixed" | "absolute";
right?: number; right?: number;
bottom?: number; bottom?: number;
@ -30,7 +28,6 @@ export interface LayBacktopProps {
color?: string; color?: string;
borderRadius?: number | string; borderRadius?: number | string;
circle?: boolean; circle?: boolean;
/**图标样式*/
icon?: string; icon?: string;
iconSize?: number; iconSize?: number;
iconColor?: string; iconColor?: string;

View File

View File

View File

@ -7,10 +7,11 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { provide, withDefaults } from "vue"; import { provide, withDefaults } from "vue";
const props = withDefaults( export interface LayBreadcrumbProps {
defineProps<{
separator?: string; separator?: string;
}>(), }
const props = withDefaults(defineProps<LayBreadcrumbProps>(),
{ {
separator: "/", separator: "/",
} }

View File

View File

@ -19,11 +19,13 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { inject, useSlots } from "vue"; import { inject, useSlots } from "vue";
export interface LayBreadcrumbItemProps {
title?: string;
}
const slot = useSlots(); const slot = useSlots();
const props = defineProps<{ const props = defineProps<LayBreadcrumbItemProps>();
title?: string;
}>();
const separator = inject("separator"); const separator = inject("separator");
</script> </script>

View File

View File

@ -8,12 +8,12 @@ export default {
import { useSlots } from "vue"; import { useSlots } from "vue";
import "./index.less"; import "./index.less";
const slot = useSlots();
export interface LayCardProps { export interface LayCardProps {
title?: string; title?: string;
} }
const slot = useSlots();
const props = defineProps<LayCardProps>(); const props = defineProps<LayCardProps>();
</script> </script>

View File

View File

View File

View File

@ -7,7 +7,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
const props = defineProps<{ export interface LayColProps {
md?: string; md?: string;
xs?: string; xs?: string;
sm?: string; sm?: string;
@ -16,7 +16,9 @@ const props = defineProps<{
xsOffset?: string; xsOffset?: string;
smOffset?: string; smOffset?: string;
lgOffset?: string; lgOffset?: string;
}>(); }
const props = defineProps<LayColProps>();
const classes = computed(() => { const classes = computed(() => {
return [ return [

View File

View File

@ -12,11 +12,12 @@ import {
watch, watch,
} from "vue"; } from "vue";
const props = withDefaults( export interface LayCollapseProps {
defineProps<{
modelValue?: number | string | []; modelValue?: number | string | [];
accordion?: boolean; accordion?: boolean;
}>(), }
const props = withDefaults(defineProps<LayCollapseProps>(),
{ {
modelValue: () => [], modelValue: () => [],
accordion: false, accordion: false,

View File

View File

@ -7,12 +7,13 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { withDefaults, inject, computed, ref } from "vue"; import { withDefaults, inject, computed, ref } from "vue";
const props = withDefaults( export interface LayCollapseItemProps {
defineProps<{
id: number | string; id: number | string;
title: string; title: string;
disabled?: boolean; disabled?: boolean;
}>(), }
const props = withDefaults(defineProps<LayCollapseItemProps>(),
{ {
disabled: false, disabled: false,
} }

View File

View File

@ -0,0 +1 @@

View File

View File

@ -8,13 +8,13 @@ export default {
import { provide, ref, watch } from "vue"; import { provide, ref, watch } from "vue";
import { useClickOutside } from "@layui/hooks-vue"; import { useClickOutside } from "@layui/hooks-vue";
const dropdownRef = ref<null | HTMLElement>(null);
const isClickOutside = useClickOutside(dropdownRef);
export interface LayDropdownProps { export interface LayDropdownProps {
trigger?: string; trigger?: string;
} }
const dropdownRef = ref<null | HTMLElement>(null);
const isClickOutside = useClickOutside(dropdownRef);
const props = withDefaults(defineProps<LayDropdownProps>(), { const props = withDefaults(defineProps<LayDropdownProps>(), {
trigger: "click", trigger: "click",
}); });

View File

View File

View File

@ -8,9 +8,9 @@ import { useSlots } from "vue";
import "./index.less"; import "./index.less";
export interface LayDropdownProps { export interface LayDropdownProps {
title?: string, title?: string;
status?: '401' | '403' | '404' | '500', status?: "401" | "403" | "404" | "500";
describe?: string describe?: string;
} }
const slots = useSlots(); const slots = useSlots();

View File

@ -0,0 +1 @@

View File

@ -9,9 +9,11 @@ import { useSlots } from "vue";
const slot = useSlots(); const slot = useSlots();
const props = defineProps<{ export interface LayFieldProps {
title?: string; title?: string;
}>(); }
const props = defineProps<LayFieldProps>();
</script> </script>
<template> <template>

View File

@ -13,8 +13,7 @@ import {
modelType, modelType,
} from "../../types/form"; } from "../../types/form";
const props = withDefaults( export interface LayFormProps {
defineProps<{
model?: modelType; model?: modelType;
required?: boolean; required?: boolean;
rules?: Rule; rules?: Rule;
@ -23,7 +22,9 @@ const props = withDefaults(
requiredErrorMessage?: string; requiredErrorMessage?: string;
validateMessage?: ValidateMessages; validateMessage?: ValidateMessages;
useCN?: boolean; useCN?: boolean;
}>(), }
const props = withDefaults(defineProps<LayFormProps>(),
{ {
model: function () { model: function () {
return {}; return {};

View File

@ -31,15 +31,16 @@ import Schema, {
} from "async-validator"; } from "async-validator";
import cnValidateMessage from "./cnValidateMessage"; import cnValidateMessage from "./cnValidateMessage";
const props = withDefaults( export interface LayFormItemProps {
defineProps<{
prop?: string; prop?: string;
mode?: string; mode?: string;
label?: string; label?: string;
errorMessage?: string; errorMessage?: string;
rules?: Rule; rules?: Rule;
required?: boolean; required?: boolean;
}>(), }
const props = withDefaults(defineProps<LayFormItemProps>(),
{ {
mode: "block", mode: "block",
} }

View File

View File

View File

View File

View File

@ -5,9 +5,11 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ export interface LayLineProps {
theme?: string; theme?: string;
}>(); }
const props = defineProps<LayLineProps>();
</script> </script>
<template> <template>

View File

View File

@ -7,12 +7,14 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { inject, Ref, useSlots } from "vue"; import { inject, Ref, useSlots } from "vue";
const slots = useSlots(); export interface LayMenuItemProps {
const props = defineProps<{
id: string; id: string;
title?: string; title?: string;
}>(); }
const slots = useSlots();
const props = defineProps<LayMenuItemProps>();
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>; const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;

View File

@ -1,16 +1,13 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: "LayPage" name: "LayPage",
} };
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { Ref, ref, watch, useSlots, computed } from "vue"; import { Ref, ref, watch, useSlots, computed } from "vue";
const slots = useSlots(); export interface LayPageProps {
const props = withDefaults(
defineProps<{
total: number; total: number;
limit: number; limit: number;
theme?: string; theme?: string;
@ -22,8 +19,11 @@ const props = withDefaults(
showRefresh?: boolean | string; showRefresh?: boolean | string;
pages?: number; pages?: number;
limits?: number[]; limits?: number[];
}>(), }
{
const slots = useSlots();
const props = withDefaults(defineProps<LayPageProps>(), {
limit: 10, limit: 10,
theme: "green", theme: "green",
showPage: false, showPage: false,
@ -34,8 +34,7 @@ const props = withDefaults(
showRefresh: false, showRefresh: false,
pages: 10, pages: 10,
limits: () => [10, 20, 30, 40, 50], limits: () => [10, 20, 30, 40, 50],
} });
);
const limits = ref(props.limits); const limits = ref(props.limits);
const pages = props.pages / 2; const pages = props.pages / 2;
const inlimit = computed({ const inlimit = computed({

View File

@ -0,0 +1 @@

View File

@ -30,8 +30,8 @@ import {
onMounted, onMounted,
} from "vue"; } from "vue";
import { on } from "../../utils/domUtil"; import { on } from "../../utils/domUtil";
const props = withDefaults(
defineProps<{ export interface LayPopperProps {
el: any; el: any;
content?: string | Number; content?: string | Number;
position?: string; position?: string;
@ -41,7 +41,9 @@ const props = withDefaults(
disabled?: boolean; disabled?: boolean;
visible?: boolean; visible?: boolean;
isCanHide?: boolean; isCanHide?: boolean;
}>(), }
const props = withDefaults(defineProps<LayPopperProps>(),
{ {
position: 'top', position: 'top',
isDark: true, isDark: true,

View File

@ -7,14 +7,16 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
const props = defineProps<{ export interface LayProgressProps {
percent: number | string; percent: number | string;
theme?: string; theme?: string;
color?: string; color?: string;
size?: string; size?: string;
showText?: boolean; showText?: boolean;
text?: string; text?: string;
}>(); }
const props = defineProps<LayProgressProps>();
const styles = computed(() => { const styles = computed(() => {
return [ return [

View File

View File

@ -5,12 +5,14 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ export interface LayRadioProps {
modelValue: string; modelValue: string;
disabled?: boolean; disabled?: boolean;
label?: string; label?: string;
name: string; name: string;
}>(); }
const props = defineProps<LayRadioProps>();
const emit = defineEmits(["update:modelValue", "change"]); const emit = defineEmits(["update:modelValue", "change"]);

View File

View File

View File

View File

View File

@ -20,6 +20,16 @@ import {
import { useClickOutside } from "@layui/hooks-vue"; import { useClickOutside } from "@layui/hooks-vue";
import { SelectItem } from "../../types"; import { SelectItem } from "../../types";
export interface LaySelectProps {
modelValue?: string | number | [] | null;
name?: string;
placeholder?: string;
disabled?: boolean;
showEmpty?: boolean;
emptyMessage?: string;
multiple?: boolean;
}
const selectRef = ref<null | HTMLElement>(null); const selectRef = ref<null | HTMLElement>(null);
const isClickOutside = useClickOutside(selectRef); const isClickOutside = useClickOutside(selectRef);
@ -30,15 +40,7 @@ watch(isClickOutside, () => {
}); });
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<LaySelectProps>(),
modelValue?: string | number | [] | null;
name?: string;
placeholder?: string;
disabled?: boolean;
showEmpty?: boolean;
emptyMessage?: string;
multiple?: boolean;
}>(),
{ {
modelValue: null, modelValue: null,
placeholder: "请选择", placeholder: "请选择",

View File

View File

@ -9,12 +9,13 @@ import LayCheckbox from "../checkbox";
import { SelectItem, SelectItemHandle, SelectItemPush } from "../../types"; import { SelectItem, SelectItemHandle, SelectItemPush } from "../../types";
import { computed, inject, onMounted, Ref } from "vue"; import { computed, inject, onMounted, Ref } from "vue";
const props = withDefaults( export interface LaySelectOptionProps {
defineProps<{
value: string | null | undefined; value: string | null | undefined;
label?: string; label?: string;
disabled?: boolean; disabled?: boolean;
}>(), }
const props = withDefaults(defineProps<LaySelectOptionProps>(),
{ {
disabled: false, disabled: false,
} }

View File

View File

View File

View File

View File

@ -106,9 +106,7 @@ import { Ref, ref, toRef } from "vue";
import { on, off } from "evtd"; import { on, off } from "evtd";
import "./index.less"; import "./index.less";
const emit = defineEmits(["update:modelValue"]); export interface LaySliderProps {
interface LaySliderProps {
vertical?: boolean; vertical?: boolean;
modelValue?: number | Array<number>; modelValue?: number | Array<number>;
min?: number; min?: number;
@ -120,6 +118,8 @@ interface LaySliderProps {
standardrange?: number[]; standardrange?: number[];
} }
const emit = defineEmits(["update:modelValue"]);
const props = withDefaults(defineProps<LaySliderProps>(), { const props = withDefaults(defineProps<LaySliderProps>(), {
vertical: false, vertical: false,
modelValue: 0, modelValue: 0,

View File

View File

@ -8,16 +8,16 @@ export default {
import { ref, watch, provide, withDefaults, onMounted } from "vue"; import { ref, watch, provide, withDefaults, onMounted } from "vue";
import "./index.less"; import "./index.less";
//
export interface LayStepProps { export interface LayStepProps {
vertical?: boolean; vertical?: boolean;
minSize?: number; minSize?: number;
} }
// props
const props = withDefaults(defineProps<LayStepProps>(), { const props = withDefaults(defineProps<LayStepProps>(), {
vertical: false, vertical: false,
minSize: 50, minSize: 50,
}); });
let domEvent = ref(); let domEvent = ref();
let domStatus = ref(false); let domStatus = ref(false);
const target = ref(); const target = ref();

View File

View File

View File

View File

@ -7,12 +7,14 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { computed, inject, Ref, useSlots } from "vue"; import { computed, inject, Ref, useSlots } from "vue";
const slots = useSlots(); export interface LaySubMenuProps {
const props = defineProps<{
id: string; id: string;
title?: string; title?: string;
}>(); }
const slots = useSlots();
const props = defineProps<LaySubMenuProps>();
const isTree = inject("isTree"); const isTree = inject("isTree");
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>; const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;

View File

View File

@ -0,0 +1 @@

View File

@ -17,6 +17,14 @@ import {
watch, watch,
} from "vue"; } from "vue";
export interface LayTabProps {
type?: string;
modelValue: string;
allowClose?: boolean;
beforeClose?: Function;
beforeLeave?: Function;
}
const slot = useSlots(); const slot = useSlots();
const slots = slot.default && slot.default(); const slots = slot.default && slot.default();
const childrens: Ref<VNode[]> = ref([]); const childrens: Ref<VNode[]> = ref([]);
@ -32,13 +40,7 @@ const setItemInstanceBySlot = function (nodeList: VNode[]) {
}); });
}; };
const props = defineProps<{ const props = defineProps<LayTabProps>();
type?: string;
modelValue: string;
allowClose?: boolean;
beforeClose?: Function;
beforeLeave?: Function;
}>();
const emit = defineEmits(["update:modelValue", "change", "close"]); const emit = defineEmits(["update:modelValue", "change", "close"]);

View File

@ -0,0 +1 @@

View File

@ -7,12 +7,14 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { withDefaults, inject, Ref } from "vue"; import { withDefaults, inject, Ref } from "vue";
const props = withDefaults( export interface LayTabItemProps {
defineProps<{
id: string; id: string;
title: string; title: string;
closable?: boolean | string; closable?: boolean | string;
}>(), }
const props = withDefaults(
defineProps<LayTabItemProps>(),
{ {
closable: true, closable: true,
} }

View File

View File

@ -22,8 +22,7 @@ import "./index.less";
const tableId = guid(); const tableId = guid();
const props = withDefaults( export interface LayTableProps {
defineProps<{
id?: string; id?: string;
skin?: string; skin?: string;
size?: string; size?: string;
@ -33,7 +32,9 @@ const props = withDefaults(
dataSource: Recordable[]; dataSource: Recordable[];
defaultToolbar?: boolean; defaultToolbar?: boolean;
selectedKeys?: Recordable[]; selectedKeys?: Recordable[];
}>(), }
const props = withDefaults(defineProps<LayTableProps>(),
{ {
id: "id", id: "id",
size: "md", size: "md",

View File

@ -0,0 +1 @@
import { Recordable } from "../../types";

View File

View File

@ -7,13 +7,13 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { useSlots } from "vue"; import { useSlots } from "vue";
const slot = useSlots();
export interface LayTimelineItemProps { export interface LayTimelineItemProps {
title: string; title: string;
simple?: boolean; simple?: boolean;
} }
const slot = useSlots();
const props = defineProps<LayTimelineItemProps>(); const props = defineProps<LayTimelineItemProps>();
</script> </script>

View File

View File

@ -9,14 +9,14 @@ import "./index.less";
import { Ref, ref, useSlots, watch } from "vue"; import { Ref, ref, useSlots, watch } from "vue";
import { Recordable } from "../../types"; import { Recordable } from "../../types";
const slot = useSlots();
export interface LayTransferProps { export interface LayTransferProps {
id?: string; id?: string;
title?: string[]; title?: string[];
dataSource: Recordable[]; dataSource: Recordable[];
} }
const slot = useSlots();
const props = withDefaults(defineProps<LayTransferProps>(), { const props = withDefaults(defineProps<LayTransferProps>(), {
id: "id", id: "id",
title: () => ["主列表", "副列表"], title: () => ["主列表", "副列表"],

View File

@ -0,0 +1,2 @@
import { Recordable } from "../../types";