init
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { w as withInstall } from "../badge/index2.js";
|
||||
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
||||
var index = /* @__PURE__ */ (() => ":root{--card-border-radius: var(--global-border-radius)}.layui-card{margin-bottom:15px;background-color:#fff;border-radius:var(--card-border-radius)}.layui-card .layui-card-header{height:42px;line-height:42px;padding:0 15px;border-bottom:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-footer{height:42px;line-height:42px;padding:0 15px;border-top:1px solid #f6f6f6;font-size:14px}.layui-card .layui-card-header .layui-card-header-extra{float:right}.layui-card .layui-card-body{padding:10px 15px;line-height:24px}.layui-card:last-child{margin-bottom:0}.layui-card.is-hover-shadow:hover,.layui-card.shadow{box-shadow:0 1px 2px #0000000d}\n")();
|
||||
const _hoisted_1 = {
|
||||
key: 0,
|
||||
class: "layui-card-header"
|
||||
};
|
||||
const _hoisted_2 = { class: "layui-card-header-title" };
|
||||
const _hoisted_3 = {
|
||||
key: 0,
|
||||
class: "layui-card-header-extra"
|
||||
};
|
||||
const _hoisted_4 = { class: "layui-card-body" };
|
||||
const _hoisted_5 = {
|
||||
key: 1,
|
||||
class: "layui-card-footer"
|
||||
};
|
||||
const __default__ = {
|
||||
name: "LayCard"
|
||||
};
|
||||
const _sfc_main = defineComponent({
|
||||
...__default__,
|
||||
props: {
|
||||
title: null,
|
||||
shadow: { default: "always" }
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const slots = useSlots();
|
||||
const classes = computed(() => {
|
||||
return {
|
||||
shadow: props.shadow === "always",
|
||||
"is-hover-shadow": props.shadow === "hover"
|
||||
};
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
class: normalizeClass(["layui-card", unref(classes)])
|
||||
}, [
|
||||
unref(slots).title || __props.title || unref(slots).extra ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
||||
createElementVNode("span", _hoisted_2, [
|
||||
renderSlot(_ctx.$slots, "title", {}, () => [
|
||||
createTextVNode(toDisplayString(__props.title), 1)
|
||||
])
|
||||
]),
|
||||
unref(slots).extra ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
||||
renderSlot(_ctx.$slots, "extra")
|
||||
])) : createCommentVNode("", true)
|
||||
])) : createCommentVNode("", true),
|
||||
createElementVNode("div", _hoisted_4, [
|
||||
unref(slots).body ? renderSlot(_ctx.$slots, "body", { key: 0 }) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
||||
]),
|
||||
unref(slots).footer ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
||||
renderSlot(_ctx.$slots, "footer")
|
||||
])) : createCommentVNode("", true)
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
const component = withInstall(_sfc_main);
|
||||
export { component as default };
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayTimelineItem",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSlots } from "vue";
|
||||
|
||||
export interface TimelineItemProps {
|
||||
title?: string;
|
||||
simple?: boolean;
|
||||
}
|
||||
|
||||
const slot = useSlots();
|
||||
|
||||
const props = defineProps<TimelineItemProps>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"><slot name="dot"></slot></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<div v-if="simple" class="layui-timeline-title">
|
||||
<slot name="title">{{ title }}</slot>
|
||||
</div>
|
||||
<h3 v-else class="layui-timeline-title">
|
||||
<slot name="title">{{ title }}</slot>
|
||||
</h3>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* 获取年份列表
|
||||
*/
|
||||
const getYears = () => {
|
||||
let years = [];
|
||||
for (let i = 1970; i < getYear() + 100; i++) {
|
||||
years.push(i);
|
||||
}
|
||||
return years;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前日期
|
||||
*/
|
||||
const getDate = (val = "") => {
|
||||
if (val) {
|
||||
return new Date(val);
|
||||
} else {
|
||||
return new Date();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前年份
|
||||
*/
|
||||
const getYear = (val = "") => {
|
||||
return getDate(val).getFullYear();
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前月份
|
||||
*/
|
||||
const getMonth = (val = "") => {
|
||||
return getDate(val).getMonth();
|
||||
};
|
||||
|
||||
const getDay = (val = "") => {
|
||||
if (val) {
|
||||
return new Date(getDate(val).toDateString()).getTime();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取月份天数
|
||||
*
|
||||
* @param year
|
||||
* @param month
|
||||
*/
|
||||
const getDayLength = (year: number, month: number): number => {
|
||||
return new Date(year, month + 1, 0).getDate();
|
||||
};
|
||||
|
||||
// 设置日期列表
|
||||
const setDateList = (year: number, month: number) => {
|
||||
const curDays = getDayLength(year, month); // 当月天数
|
||||
const prevDays = getDayLength(year, month - 1); // 上月天数
|
||||
const curFirstDayWeek = new Date(year, month, 1).getDay(); // 当月第一天星期几
|
||||
const list: any[] = [];
|
||||
// 填充上月天数
|
||||
for (let i = prevDays - curFirstDayWeek + 1; i <= prevDays; i++) {
|
||||
list.push({
|
||||
day: i,
|
||||
value: +new Date(year, month - 1, i),
|
||||
isRange: false,
|
||||
isSelected: false,
|
||||
type: "prev",
|
||||
});
|
||||
}
|
||||
// 填充当月天数
|
||||
for (let i = 1; i <= curDays; i++) {
|
||||
list.push({
|
||||
day: i,
|
||||
value: +new Date(year, month, i),
|
||||
isRange: false,
|
||||
isSelected: false,
|
||||
type: "current",
|
||||
});
|
||||
}
|
||||
// 填充下月天数
|
||||
const nextDays = 7 - (list.length % 7);
|
||||
if (nextDays !== 7) {
|
||||
for (let i = 1; i <= nextDays; i++) {
|
||||
list.push({
|
||||
day: i,
|
||||
value: +new Date(year, month + 1, i),
|
||||
isRange: false,
|
||||
isSelected: false,
|
||||
type: "next",
|
||||
});
|
||||
}
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
export {
|
||||
getDayLength,
|
||||
getYears,
|
||||
getDate,
|
||||
getMonth,
|
||||
getYear,
|
||||
getDay,
|
||||
setDateList,
|
||||
};
|
||||
Binary file not shown.
Reference in New Issue
Block a user