From c7c4e69930a2f4008ddb970f350ac382949bef81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Sun, 27 Mar 2022 06:03:30 +0800 Subject: [PATCH 1/7] =?UTF-8?q?perf(date-picker):=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/datePicker/day.ts | 36 ++++++++ src/component/datePicker/index.vue | 137 +++++++++-------------------- 2 files changed, 78 insertions(+), 95 deletions(-) create mode 100644 src/component/datePicker/day.ts diff --git a/src/component/datePicker/day.ts b/src/component/datePicker/day.ts new file mode 100644 index 00000000..c84f43f8 --- /dev/null +++ b/src/component/datePicker/day.ts @@ -0,0 +1,36 @@ +/** + * 获取年份列表 + */ +const getYears = () => { + let years = []; + for (let i = 1970; i < getYear() + 100; i++) { + years.push(i); + } + return years; +} + +/** + * 获取当前日期 + */ +const getDate = () => { + return new Date(); +} + +/** + * 获取当前年份 + */ +const getYear = () => { + return getDate().getFullYear(); +} + +/** + * 获取月份天数 + * + * @param year + * @param month + */ +const getDayLength = (year: number, month: number): number => { + return new Date(year, month + 1, 0).getDate(); +}; + +export { getDayLength, getYears } \ No newline at end of file diff --git a/src/component/datePicker/index.vue b/src/component/datePicker/index.vue index 710c2cb7..06882e9d 100644 --- a/src/component/datePicker/index.vue +++ b/src/component/datePicker/index.vue @@ -17,8 +17,8 @@ >
- {{ curYear }} 年{{ curMonth + 1 }} 月 + {{ currentYear }} 年{{ currentMonth + 1 }} 月
@@ -136,8 +136,8 @@ >
- {{ curYear }} 年{{ curMonth + 1 }} 月 + {{ currentYear }} 年{{ currentMonth + 1 }} 月
@@ -178,7 +178,7 @@ - +
@@ -190,10 +190,10 @@
  • -
      +
      1. +::: + +::: title Transition 属性 +::: + +::: table + +| 属性 | 描述 | 类型 |默认值 | 可选值 | +| ------------ | ---------------- | ------------- | ---- | ---- | +| enable | 启用 | `boolean` | `true` | `true` `false` | +| type | 类型 | `string` | `collapse` | -- | + +::: + +::: title Transition 属性值 +::: + +::: table + +| 属性值 | 描述 | +| ------------ | ---------------- | +| collapse | 折叠动画 | +| fade | 淡入淡出 | ::: \ No newline at end of file diff --git a/example/docs/zh-CN/guide/changelog.md b/example/docs/zh-CN/guide/changelog.md index 04d42a79..9e734bd3 100644 --- a/example/docs/zh-CN/guide/changelog.md +++ b/example/docs/zh-CN/guide/changelog.md @@ -17,7 +17,7 @@

        0.4.3 2022-03-27

        • [修复] menu 组件 level 属性不生效。
        • -
        • [修复] step 组件 line 连线不显示。 +
        • [修复] step 组件 line 连线不显示。
diff --git a/src/component/datePicker/day.ts b/src/component/datePicker/day.ts index fed8a56c..f90add57 100644 --- a/src/component/datePicker/day.ts +++ b/src/component/datePicker/day.ts @@ -23,6 +23,13 @@ const getYear = () => { return getDate().getFullYear(); }; +/** + * 获取当前月份 + */ +const getMonth = () => { + return getDate().getMonth(); +} + /** * 获取月份天数 * @@ -33,4 +40,4 @@ const getDayLength = (year: number, month: number): number => { return new Date(year, month + 1, 0).getDate(); }; -export { getDayLength, getYears }; +export { getDayLength, getYears, getDate, getMonth, getYear }; diff --git a/src/component/datePicker/index.vue b/src/component/datePicker/index.vue index e01312ae..8ca615a2 100644 --- a/src/component/datePicker/index.vue +++ b/src/component/datePicker/index.vue @@ -242,25 +242,13 @@ import { } from "vue"; import LayInput from "../input/index.vue"; import LayDropdown from "../dropdown/index.vue"; -import { getDayLength, getYears } from "./day"; +import { getDayLength, getYears, getDate, getMonth, getYear } from "./day"; const $emits = defineEmits(["update:modelValue"]); const WEEK_NAME = ["日", "一", "二", "三", "四", "五", "六"]; -const MONTH_NAME = [ - "1月", - "2月", - "3月", - "4月", - "5月", - "6月", - "7月", - "8月", - "9月", - "10月", - "11月", - "12月", -]; +const MONTH_NAME = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]; + const hms = ref({ hh: "00", mm: "00", ss: "00" }); const els = [ { count: 24, type: "hh" }, @@ -278,9 +266,9 @@ const props = withDefaults(defineProps(), { type: "date", }); -const currentDate = new Date(); -const currentYear = ref(currentDate.getFullYear()); -const currentMonth = ref(currentDate.getMonth()); +const currentDate = getDate(); +const currentYear = ref(getYear()); +const currentMonth = ref(getMonth()); const yearList = ref(getYears()); const dateList = ref([]); From 4169967a0447e3882783330657a98de8c0157a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Sun, 27 Mar 2022 09:13:26 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20input=20=E7=BB=84=E4=BB=B6=20height?= =?UTF-8?q?=20=E9=AB=98=E5=BA=A6=E5=9B=BA=E5=AE=9A=2038=20px?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/docs/zh-CN/guide/changelog.md | 5 +++-- src/component/datePicker/day.ts | 4 ++-- src/component/datePicker/index.vue | 15 ++++++++++++++- src/component/input/index.less | 2 ++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/example/docs/zh-CN/guide/changelog.md b/example/docs/zh-CN/guide/changelog.md index 9e734bd3..87d12988 100644 --- a/example/docs/zh-CN/guide/changelog.md +++ b/example/docs/zh-CN/guide/changelog.md @@ -16,8 +16,9 @@
  • 0.4.3 2022-03-27

      -
    • [修复] menu 组件 level 属性不生效。
    • -
    • [修复] step 组件 line 连线不显示。
    • +
    • [修复] menu 组件 level 属性的语义与实际功能相悖。
    • +
    • [修复] input 组件 height 高度固定 38 px。
    • +
    • [修复] step 组件 line 样式。
  • diff --git a/src/component/datePicker/day.ts b/src/component/datePicker/day.ts index f90add57..ac142fd6 100644 --- a/src/component/datePicker/day.ts +++ b/src/component/datePicker/day.ts @@ -24,11 +24,11 @@ const getYear = () => { }; /** - * 获取当前月份 + * 获取当前月份 */ const getMonth = () => { return getDate().getMonth(); -} +}; /** * 获取月份天数 diff --git a/src/component/datePicker/index.vue b/src/component/datePicker/index.vue index 8ca615a2..fd4944bd 100644 --- a/src/component/datePicker/index.vue +++ b/src/component/datePicker/index.vue @@ -247,7 +247,20 @@ import { getDayLength, getYears, getDate, getMonth, getYear } from "./day"; const $emits = defineEmits(["update:modelValue"]); const WEEK_NAME = ["日", "一", "二", "三", "四", "五", "六"]; -const MONTH_NAME = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]; +const MONTH_NAME = [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", +]; const hms = ref({ hh: "00", mm: "00", ss: "00" }); const els = [ diff --git a/src/component/input/index.less b/src/component/input/index.less index 5c14b242..a988a0b4 100644 --- a/src/component/input/index.less +++ b/src/component/input/index.less @@ -21,6 +21,8 @@ .layui-input-wrapper { width: 100%; + height: 38px; + line-height: 38px; border-width: 1px; border-style: solid; display: inline-flex; From 0df980800c3006dbd1847bdfd77daa3f17b82bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Sun, 27 Mar 2022 09:37:47 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=B1=82=E7=BA=A7=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/src/layouts/Layout.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/src/layouts/Layout.vue b/example/src/layouts/Layout.vue index 1c7f426d..42fe9eba 100644 --- a/example/src/layouts/Layout.vue +++ b/example/src/layouts/Layout.vue @@ -308,7 +308,7 @@ export default {