From 5aaa468694e146f9a2775677b22191eb90f625b1 Mon Sep 17 00:00:00 2001 From: liweijie0812 <674416404@qq.com> Date: Tue, 23 Apr 2024 13:10:16 +0800 Subject: [PATCH 1/3] refactor(cell): sfc to tsx (#1326) * refactor(cell): sfc to tsx * test: snap update * feat: class name * test: snap update * chore: test update --- .../__test__/__snapshots__/demo.test.jsx.snap | 16 +- .../__test__/__snapshots__/demo.test.jsx.snap | 96 +- .../__test__/__snapshots__/demo.test.jsx.snap | 84 +- .../__test__/__snapshots__/demo.test.jsx.snap | 240 +-- src/cell/__test__/index.test.jsx | 4 +- src/cell/cell-group.tsx | 34 + src/cell/cell-group.vue | 32 - src/cell/cell.tsx | 99 ++ src/cell/cell.vue | 93 -- src/cell/index.ts | 4 +- .../__test__/__snapshots__/demo.test.jsx.snap | 336 +---- .../__test__/__snapshots__/demo.test.jsx.snap | 72 +- .../__test__/__snapshots__/demo.test.jsx.snap | 8 +- .../__test__/__snapshots__/demo.test.jsx.snap | 1282 ++++++++--------- .../__snapshots__/index.test.jsx.snap | 210 +-- .../__snapshots__/index.test.jsx.snap | 120 +- .../__test__/__snapshots__/demo.test.jsx.snap | 88 +- .../__test__/__snapshots__/demo.test.jsx.snap | 390 ++--- .../__test__/__snapshots__/demo.test.jsx.snap | 152 +- .../__snapshots__/index.test.jsx.snap | 67 - .../__test__/__snapshots__/demo.test.jsx.snap | 176 +-- 21 files changed, 1670 insertions(+), 1933 deletions(-) create mode 100644 src/cell/cell-group.tsx delete mode 100644 src/cell/cell-group.vue create mode 100644 src/cell/cell.tsx delete mode 100644 src/cell/cell.vue delete mode 100644 src/swiper/__test__/__snapshots__/index.test.jsx.snap diff --git a/src/badge/__test__/__snapshots__/demo.test.jsx.snap b/src/badge/__test__/__snapshots__/demo.test.jsx.snap index fdea1e9f5..b76259289 100644 --- a/src/badge/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/badge/__test__/__snapshots__/demo.test.jsx.snap @@ -679,15 +679,15 @@ exports[`Badge > Badge mobileVue demo works fine 1`] = `
- +
单行标题 - - + +
Badge mobileVue demo works fine 1`] = `
- + @@ -1119,15 +1119,15 @@ exports[`Badge > Badge themeVue demo works fine 1`] = `
- +
单行标题 - - + +
Badge themeVue demo works fine 1`] = `
- + `; diff --git a/src/calendar/__test__/__snapshots__/demo.test.jsx.snap b/src/calendar/__test__/__snapshots__/demo.test.jsx.snap index c3e606d84..e56b936b2 100644 --- a/src/calendar/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/calendar/__test__/__snapshots__/demo.test.jsx.snap @@ -2155,17 +2155,17 @@ exports[`Calendar > Calendar baseVue demo works fine 1`] = `
- +
单个选择日期 - - + +
- +
@@ -4348,17 +4348,17 @@ exports[`Calendar > Calendar customButtonVue demo works fine 1`] = `
- +
自定义按钮 - - + +
- +
@@ -4808,17 +4808,17 @@ exports[`Calendar > Calendar customRangeVue demo works fine 1`] = `
- +
自定义日期区间 - - + +
- +
@@ -5789,17 +5789,17 @@ exports[`Calendar > Calendar customTextVue demo works fine 1`] = `
- +
自定义文案 - - + +
- +
@@ -8013,17 +8013,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
单个选择日期 - - + +
- +
@@ -10200,17 +10200,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
多个选择日期 - - + +
- +
@@ -12387,17 +12387,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
区间选择日期 - - + +
- +
@@ -13386,17 +13386,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
自定义文案 - - + +
- +
@@ -15573,17 +15573,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
自定义按钮 - - + +
- +
@@ -16026,17 +16026,17 @@ exports[`Calendar > Calendar mobileVue demo works fine 1`] = `
- +
自定义日期区间 - - + +
- +
@@ -20337,17 +20337,17 @@ exports[`Calendar > Calendar multipleVue demo works fine 1`] = `
- +
多个选择日期 - - + +
- +
@@ -22527,17 +22527,17 @@ exports[`Calendar > Calendar rangeVue demo works fine 1`] = `
- +
区间选择日期 - - + +
- +
diff --git a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap index 459264e91..6b7fe1dad 100644 --- a/src/cascader/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/cascader/__test__/__snapshots__/demo.test.jsx.snap @@ -11,15 +11,15 @@ exports[`Cascader > Cascader baseVue demo works fine 1`] = `
- +
地址 - - + +
Cascader checkStrictlyVue demo works fine 1`] = `
- +
地址 - - + +
Cascader keysVue demo works fine 1`] = `
- +
地址 - - + +
Cascader lazyVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader mobileVue demo works fine 1`] = `
- +
地址 - - + +
Cascader themeTabVue demo works fine 1`] = `
- +
地址 - - + +
Cascader withTitleVue demo works fine 1`] = `
- +
地址 - - + +
Cascader withValueVue demo works fine 1`] = `
- +
地址 - - + +
Cell groupVue demo works fine 1`] = `
- +
@@ -35,10 +35,10 @@ exports[`Cell > Cell groupVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -88,10 +88,10 @@ exports[`Cell > Cell groupVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -141,10 +141,10 @@ exports[`Cell > Cell groupVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -213,7 +213,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
@@ -224,17 +224,17 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - - + +
- +
@@ -262,7 +262,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
Cell mobileVue demo works fine 1`] = ` >  * - +
- +
@@ -304,15 +304,15 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell mobileVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell mobileVue demo works fine 1`] = `
- +
Cell mobileVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -518,7 +518,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
@@ -529,21 +529,21 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - +
一段很长很长的内容文字
- +
@@ -571,7 +571,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
Cell mobileVue demo works fine 1`] = ` 一段很长很长的内容文字
- +
@@ -617,14 +617,14 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - +
@@ -681,14 +681,14 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - +
@@ -715,7 +715,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
Cell mobileVue demo works fine 1`] = `
- +
单行标题 - +
@@ -793,14 +793,14 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - +
一段很长很长的内容文字
- +
@@ -828,22 +828,22 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
单行标题 - +
一段很长很长的内容文字,长文本自动换行,该选项的描述是一段很长的内容
- - + +
Cell mobileVue demo works fine 1`] = `
- +
多行高度不定,长文本自动换行,该选项的描述是一段很长的内容 - +
一段很长很长的内容文字,长文本自动换行,该选项的描述是一段很长的内容
- - + +
Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 多行带头像 - +
一段很长很长的内容文字
- +
@@ -988,7 +988,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- + Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 多行带图片 - +
一段很长很长的内容文字
- - + +
@@ -1039,7 +1039,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
- +
@@ -1072,10 +1072,10 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -1125,10 +1125,10 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -1178,10 +1178,10 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
@@ -1214,7 +1214,7 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = ` exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
@@ -1225,21 +1225,21 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
单行标题 - +
一段很长很长的内容文字
- +
@@ -1267,7 +1267,7 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
Cell multipleVue demo works fine 1`] = ` 一段很长很长的内容文字
- +
@@ -1313,14 +1313,14 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
单行标题 - +
@@ -1377,14 +1377,14 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
单行标题 - +
@@ -1411,7 +1411,7 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
Cell multipleVue demo works fine 1`] = `
- +
单行标题 - +
@@ -1489,14 +1489,14 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - +
一段很长很长的内容文字
- +
@@ -1524,22 +1524,22 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- +
单行标题 - +
一段很长很长的内容文字,长文本自动换行,该选项的描述是一段很长的内容
- - + +
Cell multipleVue demo works fine 1`] = `
- +
多行高度不定,长文本自动换行,该选项的描述是一段很长的内容 - +
一段很长很长的内容文字,长文本自动换行,该选项的描述是一段很长的内容
- - + +
Cell multipleVue demo works fine 1`] = ` class="t-cell__title" > 多行带头像 - +
一段很长很长的内容文字
- +
@@ -1684,7 +1684,7 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
- + Cell multipleVue demo works fine 1`] = ` class="t-cell__title" > 多行带图片 - +
一段很长很长的内容文字
- - + +
@@ -1711,7 +1711,7 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = ` exports[`Cell > Cell singleVue demo works fine 1`] = `
- +
@@ -1722,17 +1722,17 @@ exports[`Cell > Cell singleVue demo works fine 1`] = `
- +
单行标题 - - + +
- +
@@ -1760,7 +1760,7 @@ exports[`Cell > Cell singleVue demo works fine 1`] = `
- +
Cell singleVue demo works fine 1`] = ` >  * - +
- +
@@ -1802,15 +1802,15 @@ exports[`Cell > Cell singleVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell singleVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell singleVue demo works fine 1`] = `
- +
Cell singleVue demo works fine 1`] = `
- +
单行标题 - - + +
Cell singleVue demo works fine 1`] = ` class="t-cell__title" > 单行标题 - - + +
- +
diff --git a/src/cell/__test__/index.test.jsx b/src/cell/__test__/index.test.jsx index 42f659dbd..ba0275d39 100644 --- a/src/cell/__test__/index.test.jsx +++ b/src/cell/__test__/index.test.jsx @@ -2,8 +2,8 @@ import { h } from 'vue'; import { mount } from '@vue/test-utils'; import { describe, it, expect } from 'vitest'; import { ChevronRightIcon, AppIcon } from 'tdesign-icons-vue-next'; -import Cell from '../cell.vue'; -import CellGroup from '../cell-group.vue'; +import Cell from '../cell'; +import CellGroup from '../cell-group'; import Avatar from '../../avatar/avatar.vue'; const appIcon = () => h(AppIcon); diff --git a/src/cell/cell-group.tsx b/src/cell/cell-group.tsx new file mode 100644 index 000000000..675f61e2c --- /dev/null +++ b/src/cell/cell-group.tsx @@ -0,0 +1,34 @@ +import { computed, defineComponent } from 'vue'; +import CellGroupProps from './cell-group-props'; +import config from '../config'; +import { usePrefixClass } from '../hooks/useClass'; +import { useContent, useTNodeJSX } from '../hooks/tnode'; + +const { prefix } = config; +const name = `${prefix}-cell-group`; + +export default defineComponent({ + name, + props: CellGroupProps, + emits: ['click'], + setup(props) { + const renderTNodeJSX = useTNodeJSX(); + const cellGroupClass = usePrefixClass('cell-group'); + + const contentClasses = computed(() => [ + cellGroupClass.value, + `${cellGroupClass.value}--${props.theme}`, + { [`${cellGroupClass.value}--bordered`]: props.bordered }, + ]); + + return () => { + const title = renderTNodeJSX('title'); + return ( +
+ {title ?
{title}
: null} +
{renderTNodeJSX('default')}
+
+ ); + }; + }, +}); diff --git a/src/cell/cell-group.vue b/src/cell/cell-group.vue deleted file mode 100644 index 13982856b..000000000 --- a/src/cell/cell-group.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/src/cell/cell.tsx b/src/cell/cell.tsx new file mode 100644 index 000000000..943cc5d99 --- /dev/null +++ b/src/cell/cell.tsx @@ -0,0 +1,99 @@ +import { computed, defineComponent } from 'vue'; +import { ChevronRightIcon } from 'tdesign-icons-vue-next'; +import { Hover } from '../shared'; +import config from '../config'; +import CellProps from './props'; +import { useFormDisabled } from '../form/hooks'; +import { usePrefixClass } from '../hooks/useClass'; +import { useContent, useTNodeJSX } from '../hooks/tnode'; + +const { prefix } = config; +const name = `${prefix}-cell`; + +export default defineComponent({ + name, + directives: { Hover }, + props: CellProps, + emits: ['click'], + setup(props) { + const readerTNodeJSX = useTNodeJSX(); + const readerTNodeContent = useContent(); + const disabled = useFormDisabled(); + const cellClass = usePrefixClass('cell'); + + const cellClasses = computed(() => [ + `${cellClass.value}`, + `${cellClass.value}--${props.align}`, + { + [`${cellClass.value}--borderless`]: !props.bordered, + }, + ]); + + const hoverDisabled = computed(() => !props.hover || disabled.value); + + const handleClick = (e: Event) => { + if (!disabled.value) { + props.onClick?.(e); + } + }; + + const readerImage = () => { + if (typeof props.image === 'string') { + return ; + } + const image = readerTNodeJSX('image'); + + return image; + }; + + const readerLeft = () => { + const leftIcon = readerTNodeJSX('leftIcon'); + return ( +
+ {leftIcon &&
{leftIcon}
} + {readerImage()} +
+ ); + }; + const readerTitle = () => { + const title = readerTNodeJSX('title'); + if (!title) { + return null; + } + const description = readerTNodeJSX('description'); + return ( +
+ {title} + {props.required &&  *} + {description &&
{description}
} +
+ ); + }; + const readerRight = () => { + const rightIcon = props.arrow ? : readerTNodeJSX('rightIcon'); + if (!rightIcon) { + return null; + } + return ( +
+
{rightIcon}
+
+ ); + }; + + const note = readerTNodeContent('default', 'note'); + + return () => ( +
+ {readerLeft()} + {readerTitle()} + {note &&
{note}
} + {readerRight()} +
+ ); + }, +}); diff --git a/src/cell/cell.vue b/src/cell/cell.vue deleted file mode 100644 index 02fff6fd9..000000000 --- a/src/cell/cell.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - diff --git a/src/cell/index.ts b/src/cell/index.ts index fdfb20a69..684e53ae7 100644 --- a/src/cell/index.ts +++ b/src/cell/index.ts @@ -1,5 +1,5 @@ -import Cell from './cell.vue'; -import _CellGroup from './cell-group.vue'; +import Cell from './cell'; +import _CellGroup from './cell-group'; import { withInstall, WithInstallType } from '../shared'; import { TdCellProps, TdCellGroupProps } from './type'; diff --git a/src/collapse/__test__/__snapshots__/demo.test.jsx.snap b/src/collapse/__test__/__snapshots__/demo.test.jsx.snap index 5d6d7c44e..e868c9423 100644 --- a/src/collapse/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/collapse/__test__/__snapshots__/demo.test.jsx.snap @@ -18,13 +18,7 @@ exports[`Collapse > Collapse accordionVue demo works fine 1`] = `
-
- - - -
+
Collapse accordionVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse accordionVue demo works fine 1`] = `
-
- - - -
+
Collapse accordionVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse accordionVue demo works fine 1`] = `
-
- - - -
+
Collapse accordionVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse accordionVue demo works fine 1`] = `
-
- - - -
+
Collapse accordionVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse actionVue demo works fine 1`] = `
-
- - - -
+
Collapse actionVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse baseVue demo works fine 1`] = `
-
- - - -
+
Collapse baseVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -509,13 +467,7 @@ exports[`Collapse > Collapse cardVue demo works fine 1`] = `
-
- - - -
+
Collapse cardVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -586,13 +532,7 @@ exports[`Collapse > Collapse cardVue demo works fine 1`] = `
-
- - - -
+
Collapse cardVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -663,13 +597,7 @@ exports[`Collapse > Collapse cardVue demo works fine 1`] = `
-
- - - -
+
Collapse cardVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -740,13 +662,7 @@ exports[`Collapse > Collapse cardVue demo works fine 1`] = `
-
- - - -
+
Collapse cardVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -861,13 +771,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -964,13 +862,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -1063,13 +949,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - + +
Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -1584,13 +1428,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -1661,13 +1493,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -1738,13 +1558,7 @@ exports[`Collapse > Collapse mobileVue demo works fine 1`] = `
-
- - - -
+
Collapse mobileVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
@@ -1829,13 +1637,7 @@ exports[`Collapse > Collapse placementVue demo works fine 1`] = `
-
- - - -
+
Collapse placementVue demo works fine 1`] = ` 折叠面板标题 - - -
-
- - +
+
diff --git a/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap b/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap index 49cea9b30..c5ab95013 100644 --- a/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/date-time-picker/__test__/__snapshots__/demo.test.jsx.snap @@ -11,22 +11,22 @@ exports[`DateTimePicker > DateTimePicker baseVue demo works fine 1`] = `
- +
选择日期(年月日) - - + +
年 月 日
- +
DateTimePicker customRangeVue demo works fine 1`] = `
- +
选择日期 - - + +
年 月 日
- +
DateTimePicker fullVue demo works fine 1`] = `
- +
选择日期(年月日时分) - - + +
2020-08-10 12:50:00
- +
DateTimePicker mobileVue demo works fine 1`] = `
- +
选择日期(年月日) - - + +
年 月 日
- +
DateTimePicker mobileVue demo works fine 1`] = `
- +
选择日期(年月) - - + +
年 月
- +
DateTimePicker mobileVue demo works fine 1`] = `
- +
选择日期(时分) - - + +
时 分
- +
DateTimePicker mobileVue demo works fine 1`] = `
- +
选择日期 - - + +
年 月 日
- +
DateTimePicker timeVue demo works fine 1`] = `
- +
选择日期(时分) - - + +
时 分
- +
DateTimePicker yearMonthVue demo works fine 1`] = `
- +
选择日期(年月) - - + +
年 月
- +
Form mobileVue demo works fine 1`] = `
- +
禁用态 - - + +
Form mobileVue demo works fine 1`] = `
- +
diff --git a/src/indexes/__test__/__snapshots__/demo.test.jsx.snap b/src/indexes/__test__/__snapshots__/demo.test.jsx.snap index b4696bb79..07ffbc8b1 100644 --- a/src/indexes/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/indexes/__test__/__snapshots__/demo.test.jsx.snap @@ -99,7 +99,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -111,18 +111,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
阿坝 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
阿拉善 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
阿里 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
安康 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
安庆 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
鞍山 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
安顺 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
安阳 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
澳门 - - + +
- - + +
@@ -302,7 +302,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -314,18 +314,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
北京 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
白银 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
保定 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
宝鸡 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
保山 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
包头 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
巴中 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
北海 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
蚌埠 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
本溪 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
毕节 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
滨州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
百色 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
亳州 - - + +
- - + +
@@ -600,7 +600,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -612,18 +612,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
重庆 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
成都 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
长沙 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
长春 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
沧州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
常德 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
昌都 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
长治 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
常州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
巢湖 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
潮州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
承德 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
郴州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
赤峰 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
池州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
崇左 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
楚雄 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
滁州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
朝阳 - - + +
- - + +
@@ -993,7 +993,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -1005,18 +1005,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
大连 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
东莞 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
大理 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
丹东 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
大庆 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
大同 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
大兴安岭 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
德宏 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
德阳 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
德州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
定西 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
迪庆 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
东营 - - + +
- - + +
@@ -1272,7 +1272,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -1284,18 +1284,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
鄂尔多斯 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
恩施 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
鄂州 - - + +
- - + +
@@ -1361,7 +1361,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -1373,18 +1373,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
福州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
防城港 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
佛山 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
抚顺 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
抚州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
阜新 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
阜阳 - - + +
- - + +
@@ -1526,7 +1526,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -1538,18 +1538,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
广州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
桂林 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
贵阳 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
甘南 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
赣州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
甘孜 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
广安 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
广元 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
贵港 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
果洛 - - + +
- - + +
@@ -1748,7 +1748,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -1760,18 +1760,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
揭阳 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
吉林 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
晋江 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
吉安 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
胶州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
嘉兴 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
济南 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
鸡西 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
荆州 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
江门 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
基隆 - - + +
- - + +
@@ -1989,7 +1989,7 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
@@ -2001,18 +2001,18 @@ exports[`Indexes > Indexes baseVue demo works fine 1`] = `
- +
昆明 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
开封 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
康定 - - + +
- - + +
Indexes baseVue demo works fine 1`] = `
- +
喀什 - - + +
- - + +
@@ -2173,7 +2173,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2185,18 +2185,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2306,7 +2306,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2318,18 +2318,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2439,7 +2439,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2451,18 +2451,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2572,7 +2572,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2584,18 +2584,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2705,7 +2705,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2717,18 +2717,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2838,7 +2838,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2850,18 +2850,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
@@ -2971,7 +2971,7 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
@@ -2983,18 +2983,18 @@ exports[`Indexes > Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
Indexes customVue demo works fine 1`] = `
- +
列表内容 - - + +
- - + +
diff --git a/src/indexes/__test__/__snapshots__/index.test.jsx.snap b/src/indexes/__test__/__snapshots__/index.test.jsx.snap index 0b128cb56..799ff2778 100644 --- a/src/indexes/__test__/__snapshots__/index.test.jsx.snap +++ b/src/indexes/__test__/__snapshots__/index.test.jsx.snap @@ -87,10 +87,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -98,7 +98,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -117,7 +117,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -136,7 +136,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -155,7 +155,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -174,7 +174,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -205,10 +205,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -216,7 +216,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -235,7 +235,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -254,7 +254,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -273,7 +273,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -292,7 +292,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -323,10 +323,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -334,7 +334,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -353,7 +353,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -372,7 +372,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -391,7 +391,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -410,7 +410,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -441,10 +441,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -452,7 +452,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -471,7 +471,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -490,7 +490,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -509,7 +509,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -528,7 +528,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -559,10 +559,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -570,7 +570,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -589,7 +589,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -608,7 +608,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -627,7 +627,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -646,7 +646,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -677,10 +677,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -688,7 +688,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -707,7 +707,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -726,7 +726,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -745,7 +745,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -764,7 +764,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
@@ -795,10 +795,10 @@ exports[`Indexes & IndexesAnchor > render 1`] = `
- +
- +
@@ -806,7 +806,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -825,7 +825,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -844,7 +844,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -863,7 +863,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
render 1`] = `
- +
- +
@@ -882,7 +882,7 @@ exports[`Indexes & IndexesAnchor > render 1`] = ` 列表内容
- +
diff --git a/src/list/__test__/__snapshots__/index.test.jsx.snap b/src/list/__test__/__snapshots__/index.test.jsx.snap index 7ff2f24eb..cbbbe27f3 100644 --- a/src/list/__test__/__snapshots__/index.test.jsx.snap +++ b/src/list/__test__/__snapshots__/index.test.jsx.snap @@ -12,10 +12,10 @@ exports[`list > event > : load-more 1`] = `
- +
- +
@@ -27,7 +27,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -50,7 +50,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -73,7 +73,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -96,7 +96,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -119,7 +119,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -142,7 +142,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -165,7 +165,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -188,7 +188,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -211,7 +211,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -234,7 +234,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -257,7 +257,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -280,7 +280,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -303,7 +303,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -326,7 +326,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -349,7 +349,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -372,7 +372,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -395,7 +395,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -418,7 +418,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -441,7 +441,7 @@ exports[`list > event > : load-more 1`] = `
- +
event > : load-more 1`] = `
- +
- +
@@ -464,7 +464,7 @@ exports[`list > event > : load-more 1`] = `
- +
Picker areaVue demo works fine 1`] = `
- +
选择地区 - - + +
- +
@@ -159,17 +159,17 @@ exports[`Picker > Picker baseVue demo works fine 1`] = `
- +
选择地区 - - + +
- +
@@ -198,17 +198,17 @@ exports[`Picker > Picker baseVue demo works fine 1`] = `
- +
选择时间 - - + +
- +
@@ -497,7 +497,7 @@ exports[`Picker > Picker cascadeVue demo works fine 1`] = `
- +
@@ -508,15 +508,15 @@ exports[`Picker > Picker cascadeVue demo works fine 1`] = `
- +
英雄 - - + +
Picker mobileVue demo works fine 1`] = `
- +
选择地区 - - + +
- +
@@ -744,17 +744,17 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
- +
选择时间 - - + +
- +
@@ -1040,17 +1040,17 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
- +
选择地区 - - + +
- +
@@ -1202,17 +1202,17 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
- +
带标题选择器 - - + +
- +
@@ -1241,17 +1241,17 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
- +
无标题选择器 - - + +
- +
@@ -1382,17 +1382,17 @@ exports[`Picker > Picker titleVue demo works fine 1`] = `
- +
带标题选择器 - - + +
- +
@@ -1421,17 +1421,17 @@ exports[`Picker > Picker titleVue demo works fine 1`] = `
- +
无标题选择器 - - + +
- +
diff --git a/src/side-bar/__test__/__snapshots__/demo.test.jsx.snap b/src/side-bar/__test__/__snapshots__/demo.test.jsx.snap index c92dced85..e72a8823d 100644 --- a/src/side-bar/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/side-bar/__test__/__snapshots__/demo.test.jsx.snap @@ -6479,7 +6479,7 @@ exports[`SideBar > SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字0 - - + +
- - + +
@@ -7320,7 +7320,7 @@ exports[`SideBar > SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字1 - - + +
- - + +
@@ -7954,7 +7954,7 @@ exports[`SideBar > SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字2 - - + +
- - + +
@@ -8588,7 +8588,7 @@ exports[`SideBar > SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字3 - - + +
- - + +
@@ -9015,7 +9015,7 @@ exports[`SideBar > SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字4 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字4 - - + +
- - + +
SideBar switchVue demo works fine 1`] = `
- +
SideBar switchVue demo works fine 1`] = ` class="t-cell__title" > 标题文字4 - - + +
- - + +
diff --git a/src/swipe-cell/__test__/__snapshots__/demo.test.jsx.snap b/src/swipe-cell/__test__/__snapshots__/demo.test.jsx.snap index 1eb9c157c..4bf56860b 100644 --- a/src/swipe-cell/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/swipe-cell/__test__/__snapshots__/demo.test.jsx.snap @@ -51,22 +51,22 @@ exports[`SwipeCell > SwipeCell doubleVue demo works fine 1`] = `
- +
左右滑操作 - - + +
辅助信息
- +
SwipeCell eventVue demo works fine 1`] = `
- +
带二次确认的操作 - - + +
辅助信息
- +
SwipeCell iconVue demo works fine 1`] = `
- +
图标加文字横排 - - + +
辅助信息
- +
SwipeCell iconVue demo works fine 1`] = `
- +
纯图标 - - + +
辅助信息
- +
SwipeCell iconVue demo works fine 1`] = `
- +
图标加文字竖排 - +
@@ -513,7 +513,7 @@ exports[`SwipeCell > SwipeCell iconVue demo works fine 1`] = ` > 辅助信息
- +
SwipeCell leftVue demo works fine 1`] = `
- +
左滑单操作 - - + +
辅助信息
- +
SwipeCell leftVue demo works fine 1`] = `
- +
左滑单操作 - +
@@ -739,7 +739,7 @@ exports[`SwipeCell > SwipeCell leftVue demo works fine 1`] = ` > 辅助信息
- +
SwipeCell leftVue demo works fine 1`] = `
- +
左滑双操作 - - + +
辅助信息
- +
SwipeCell leftVue demo works fine 1`] = `
- +
左滑三操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
左滑单操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
左滑单操作 - +
@@ -1139,7 +1139,7 @@ exports[`SwipeCell > SwipeCell mobileVue demo works fine 1`] = ` > 辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
左滑双操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
左滑三操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
右滑单操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
左右滑操作 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
图标加文字横排 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
纯图标 - - + +
辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
图标加文字竖排 - +
@@ -1854,7 +1854,7 @@ exports[`SwipeCell > SwipeCell mobileVue demo works fine 1`] = ` > 辅助信息
- +
SwipeCell mobileVue demo works fine 1`] = `
- +
带二次确认的操作 - - + +
辅助信息
- +
SwipeCell rightVue demo works fine 1`] = `
- +
右滑单操作 - - + +
辅助信息
- +
height & direction 1`] = ` -
-
- - -
- - - -
-
- - - -
-
- - - -
- - -
- - - - - - - - - - - - -
-`; diff --git a/src/switch/__test__/__snapshots__/demo.test.jsx.snap b/src/switch/__test__/__snapshots__/demo.test.jsx.snap index 9f94dc45f..33363ece0 100644 --- a/src/switch/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/switch/__test__/__snapshots__/demo.test.jsx.snap @@ -7,17 +7,17 @@ exports[`Switch > Switch baseVue demo works fine 1`] = `
- +
基础开关 - - + +
- +
@@ -52,17 +52,17 @@ exports[`Switch > Switch colorVue demo works fine 1`] = `
- +
自定义颜色开关 - - + +
- +
@@ -101,17 +101,17 @@ exports[`Switch > Switch labelVue demo works fine 1`] = `
- +
带文字开关 - - + +
- +
@@ -149,17 +149,17 @@ exports[`Switch > Switch labelVue demo works fine 1`] = `
- +
带图标开关 - - + +
- +
@@ -242,17 +242,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
基础开关 - - + +
- +
@@ -305,17 +305,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
带文字开关 - - + +
- +
@@ -353,17 +353,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
带图标开关 - - + +
- +
@@ -428,17 +428,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
自定义颜色开关 - - + +
- +
@@ -495,17 +495,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
加载状态 - - + +
- +
@@ -563,17 +563,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
加载状态 - - + +
- +
@@ -636,17 +636,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
禁用状态 - - + +
- +
@@ -678,17 +678,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
禁用状态 - - + +
- +
@@ -747,17 +747,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
大尺寸 32 - - + +
- +
@@ -791,17 +791,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
中尺寸 28 - - + +
- +
@@ -835,17 +835,17 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- +
小尺寸 24 - - + +
- +
@@ -891,17 +891,17 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
- +
大尺寸 32 - - + +
- +
@@ -935,17 +935,17 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
- +
中尺寸 28 - - + +
- +
@@ -979,17 +979,17 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
- +
小尺寸 24 - - + +
- +
@@ -1031,17 +1031,17 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
- +
加载状态 - - + +
- +
@@ -1099,17 +1099,17 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
- +
加载状态 - - + +
- +
@@ -1172,17 +1172,17 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
- +
禁用状态 - - + +
- +
@@ -1214,17 +1214,17 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
- +
禁用状态 - - + +
- +
From 639a3010e700d1577a2d93649c6e26c92ae10f2b Mon Sep 17 00:00:00 2001 From: liweijie0812 <674416404@qq.com> Date: Tue, 23 Apr 2024 13:11:16 +0800 Subject: [PATCH 2/3] refactor(switch): sfc to tsx (#1322) * refactor(switch): sfc to tsx * test: snap update * test: snap update * docs: sync api --- .../__test__/__snapshots__/demo.test.jsx.snap | 4 - .../__test__/__snapshots__/demo.test.jsx.snap | 1 - .../__test__/__snapshots__/demo.test.jsx.snap | 1 - .../__test__/__snapshots__/demo.test.jsx.snap | 26 ------ src/switch/__test__/index.test.jsx | 2 +- src/switch/index.ts | 2 +- src/switch/props.ts | 2 +- src/switch/switch.en-US.md | 7 +- src/switch/switch.md | 9 +- src/switch/switch.tsx | 79 +++++++++++++++++ src/switch/switch.vue | 85 ------------------- src/switch/type.ts | 2 +- 12 files changed, 92 insertions(+), 128 deletions(-) create mode 100644 src/switch/switch.tsx delete mode 100644 src/switch/switch.vue diff --git a/src/cell/__test__/__snapshots__/demo.test.jsx.snap b/src/cell/__test__/__snapshots__/demo.test.jsx.snap index 8152cdf8f..decdfaf0f 100644 --- a/src/cell/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/cell/__test__/__snapshots__/demo.test.jsx.snap @@ -387,7 +387,6 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
-
@@ -708,7 +707,6 @@ exports[`Cell > Cell mobileVue demo works fine 1`] = `
-
@@ -1404,7 +1402,6 @@ exports[`Cell > Cell multipleVue demo works fine 1`] = `
-
@@ -1885,7 +1882,6 @@ exports[`Cell > Cell singleVue demo works fine 1`] = `
-
diff --git a/src/form/__test__/__snapshots__/demo.test.jsx.snap b/src/form/__test__/__snapshots__/demo.test.jsx.snap index 2fecb5292..b8cf5bb92 100644 --- a/src/form/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/form/__test__/__snapshots__/demo.test.jsx.snap @@ -1709,7 +1709,6 @@ exports[`Form > Form mobileVue demo works fine 1`] = `
-
diff --git a/src/loading/__test__/__snapshots__/demo.test.jsx.snap b/src/loading/__test__/__snapshots__/demo.test.jsx.snap index f7a5cb4ef..c85410d64 100644 --- a/src/loading/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/loading/__test__/__snapshots__/demo.test.jsx.snap @@ -134,7 +134,6 @@ exports[`Loading > Loading delayVue demo works fine 1`] = `
-
diff --git a/src/switch/__test__/__snapshots__/demo.test.jsx.snap b/src/switch/__test__/__snapshots__/demo.test.jsx.snap index 33363ece0..91464e88d 100644 --- a/src/switch/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/switch/__test__/__snapshots__/demo.test.jsx.snap @@ -34,7 +34,6 @@ exports[`Switch > Switch baseVue demo works fine 1`] = `
-
@@ -79,7 +78,6 @@ exports[`Switch > Switch colorVue demo works fine 1`] = `
-
@@ -128,10 +126,7 @@ exports[`Switch > Switch labelVue demo works fine 1`] = `
- 开 - -
@@ -176,7 +171,6 @@ exports[`Switch > Switch labelVue demo works fine 1`] = `
- Switch mobileVue demo works fine 1`] = `
-
@@ -332,10 +325,7 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- 开 - -
@@ -380,7 +370,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
- Switch mobileVue demo works fine 1`] = `
-
@@ -549,7 +537,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -617,7 +604,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -663,7 +649,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -705,7 +690,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -775,7 +759,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -819,7 +802,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -863,7 +845,6 @@ exports[`Switch > Switch mobileVue demo works fine 1`] = `
-
@@ -919,7 +900,6 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
-
@@ -963,7 +943,6 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
-
@@ -1007,7 +986,6 @@ exports[`Switch > Switch sizeVue demo works fine 1`] = `
-
@@ -1085,7 +1063,6 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
-
@@ -1153,7 +1130,6 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
-
@@ -1199,7 +1175,6 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
-
@@ -1241,7 +1216,6 @@ exports[`Switch > Switch statusVue demo works fine 1`] = `
-
diff --git a/src/switch/__test__/index.test.jsx b/src/switch/__test__/index.test.jsx index 024f02778..611a80f0f 100644 --- a/src/switch/__test__/index.test.jsx +++ b/src/switch/__test__/index.test.jsx @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import { describe, it, expect, vi } from 'vitest'; -import Switch from '../switch.vue'; +import Switch from '../switch'; import { ref } from 'vue'; describe('switch', () => { diff --git a/src/switch/index.ts b/src/switch/index.ts index bb46e9d2f..536dfaf9b 100644 --- a/src/switch/index.ts +++ b/src/switch/index.ts @@ -1,4 +1,4 @@ -import Switch from './switch.vue'; +import Switch from './switch'; import { withInstall, WithInstallType } from '../shared'; import { TdSwitchProps } from './type'; diff --git a/src/switch/props.ts b/src/switch/props.ts index ade77dae2..17b72e007 100644 --- a/src/switch/props.ts +++ b/src/switch/props.ts @@ -12,7 +12,7 @@ export default { customValue: { type: Array as PropType, }, - /** 是否禁用组件,默认为 false */ + /** 是否禁用组件 */ disabled: Boolean, /** 开关的图标;[打开时的图标,关闭时的图标] */ icon: { diff --git a/src/switch/switch.en-US.md b/src/switch/switch.en-US.md index 4db5206ae..bee299409 100644 --- a/src/switch/switch.en-US.md +++ b/src/switch/switch.en-US.md @@ -1,6 +1,7 @@ :: BASE_DOC :: ## API + ### Switch Props name | type | default | description | required @@ -10,7 +11,7 @@ disabled | Boolean | - | \- | N icon | Array | [] | Typescript:`TNode[]`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N label | Array | [] | Typescript:`string[]` | N loading | Boolean | false | \- | N -size | String | medium | options:small/medium/large | N +size | String | medium | options: small/medium/large | N value | String / Number / Boolean | - | `v-model` and `v-model:value` is supported。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N defaultValue | String / Number / Boolean | - | uncontrolled property。Typescript:`T` `type SwitchValue = string \| number \| boolean`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/switch/type.ts) | N onChange | Function | | Typescript:`(value: T, context: { e: MouseEvent }) => void`
| N @@ -21,8 +22,8 @@ name | params | description -- | -- | -- change | `(value: T, context: { e: MouseEvent })` | \- +### CSS 变量 -### CSS Variables The component provides the following CSS variables, which can be used to customize styles. Name | Default Value | Description -- | -- | -- @@ -56,4 +57,4 @@ Name | Default Value | Description --td-switch-width | 45px | - --td-switch-label-font-size | 12px | - --td-switch-label-font-size | 14px | - ---td-switch-label-font-size | 16px | - +--td-switch-label-font-size | 16px | - \ No newline at end of file diff --git a/src/switch/switch.md b/src/switch/switch.md index b4f88511f..fd8c0d466 100644 --- a/src/switch/switch.md +++ b/src/switch/switch.md @@ -1,12 +1,13 @@ :: BASE_DOC :: ## API + ### Switch Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- customValue | Array | - | 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]、['open', 'close']。TS 类型:`Array` | N -disabled | Boolean | - | 是否禁用组件,默认为 false | N +disabled | Boolean | - | 是否禁用组件 | N icon | Array | [] | 开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`TNode[]`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N label | Array | [] | 开关的标签;[打开时的标签,关闭时的标签]。TS 类型:`string[]` | N loading | Boolean | false | 是否处于加载中状态 | N @@ -21,8 +22,8 @@ onChange | Function | | TS 类型:`(value: T, context: { e: MouseEvent }) => -- | -- | -- change | `(value: T, context: { e: MouseEvent })` | 数据发生变化时触发 - ### CSS 变量 + 组件提供了下列 CSS 变量,可用于自定义样式。 名称 | 默认值 | 描述 -- | -- | -- @@ -56,4 +57,4 @@ change | `(value: T, context: { e: MouseEvent })` | 数据发生变化时触发 --td-switch-width | 45px | - --td-switch-label-font-size | 12px | - --td-switch-label-font-size | 14px | - ---td-switch-label-font-size | 16px | - +--td-switch-label-font-size | 16px | - \ No newline at end of file diff --git a/src/switch/switch.tsx b/src/switch/switch.tsx new file mode 100644 index 000000000..05bd6d5d9 --- /dev/null +++ b/src/switch/switch.tsx @@ -0,0 +1,79 @@ +import { computed, defineComponent } from 'vue'; +import TLoading from '../loading'; +import { useToggle, useDefault } from '../shared'; +import config from '../config'; +import SwitchProps from './props'; +import { SwitchValue, TdSwitchProps } from './type'; +import { useFormDisabled } from '../form/hooks'; +import { usePrefixClass } from '../hooks/useClass'; + +const { prefix } = config; +const name = `${prefix}-switch`; +export default defineComponent({ + name, + props: SwitchProps, + setup(props, context) { + const switchClass = usePrefixClass('switch'); + + const disabled = useFormDisabled(); + const switchValues = props.customValue || [true, false]; + const [innerValue] = useDefault(props, context.emit, 'value', 'change'); + const { state, toggle } = useToggle(switchValues, innerValue.value); + const checked = computed(() => innerValue.value === switchValues[0]); + const switchClasses = computed(() => [ + `${switchClass.value}`, + `${switchClass.value}--${props.size}`, + { + [`${switchClass.value}--checked`]: checked.value, + [`${switchClass.value}--disabled`]: disabled.value || props.loading, + }, + ]); + const dotClasses = computed(() => [ + `${switchClass.value}__dot`, + `${switchClass.value}__dot--${props.size}`, + { + [`${switchClass.value}__dot--checked`]: checked.value, + [`${switchClass.value}__dot--plain`]: props.label?.length !== 2 && props.icon?.length !== 2 && !props.loading, + }, + ]); + const labelClasses = computed(() => [ + `${switchClass.value}__label`, + `${switchClass.value}__label--${props.size}`, + { + [`${switchClass.value}__label--checked`]: checked.value, + }, + ]); + const iconContent = computed(() => props.icon[checked.value ? 0 : 1]); + + function handleToggle(event: Event) { + event.preventDefault(); + if (disabled.value || props.loading) { + return; + } + + if (state.value === innerValue.value) { + toggle(); + } + + innerValue.value = state.value; + } + return () => { + const readerContent = () => { + if (props.loading) { + return ; + } + if (props.label.length === 2) { + return checked.value ? props.label[0] : props.label[1]; + } + return iconContent.value; + }; + return ( +
+
+
{readerContent()}
+
+
+ ); + }; + }, +}); diff --git a/src/switch/switch.vue b/src/switch/switch.vue deleted file mode 100644 index 927397350..000000000 --- a/src/switch/switch.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - diff --git a/src/switch/type.ts b/src/switch/type.ts index e83495c86..4018195f2 100644 --- a/src/switch/type.ts +++ b/src/switch/type.ts @@ -12,7 +12,7 @@ export interface TdSwitchProps { */ customValue?: Array; /** - * 是否禁用组件,默认为 false + * 是否禁用组件 */ disabled?: boolean; /** From 5ed1fc06a515e71d651995b60084830875d55b88 Mon Sep 17 00:00:00 2001 From: Dexter <52393227+dexterBo@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:25:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(date-time-picker):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=BA=86=E5=8A=A8=E6=80=81=E7=9A=84start?= =?UTF-8?q?=E5=80=BC=E6=97=A0=E6=B3=95=E5=9C=A8=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=97=B6=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=97=B6=E9=97=B4=20=20(#1324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(date-time-picker): 修复使用了动态的start值无法在第一次渲染时正确的限制时间 fix #1285 * test(picker): 更新测试用例 --- src/_common | 2 +- src/date-time-picker/__test__/index.test.jsx | 6 +- ...e-time-picker.vue => date-time-picker.tsx} | 69 ++++++------- src/date-time-picker/index.ts | 2 +- .../__test__/__snapshots__/demo.test.jsx.snap | 32 +++++-- src/picker/__test__/index.test.jsx | 4 +- src/picker/cascade.vue | 2 +- src/picker/index.ts | 2 +- .../{picker-item.vue => picker-item.tsx} | 47 ++++----- src/picker/{picker.vue => picker.tsx} | 96 +++++++++---------- 10 files changed, 129 insertions(+), 133 deletions(-) rename src/date-time-picker/{date-time-picker.vue => date-time-picker.tsx} (88%) rename src/picker/{picker-item.vue => picker-item.tsx} (72%) rename src/picker/{picker.vue => picker.tsx} (64%) diff --git a/src/_common b/src/_common index c261efa95..becfba8b1 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit c261efa959465cb49f85843761e659281b6a2b88 +Subproject commit becfba8b1e450af231fe6ed80b16fcae2d56f27a diff --git a/src/date-time-picker/__test__/index.test.jsx b/src/date-time-picker/__test__/index.test.jsx index b5b883a8a..dc5d3ccd6 100644 --- a/src/date-time-picker/__test__/index.test.jsx +++ b/src/date-time-picker/__test__/index.test.jsx @@ -3,8 +3,8 @@ import { mount } from '@vue/test-utils'; import { describe, it, expect, vi } from 'vitest'; import dayjs from 'dayjs'; -import DateTimePicker from '../date-time-picker.vue'; -import PickerItem from '../../picker/picker-item.vue'; +import DateTimePicker from '../date-time-picker'; +import PickerItem from '../../picker/picker-item'; import { DEFAULT_ITEM_HEIGHT, ANIMATION_TIME_LIMIT } from '../../picker/picker.class'; const makeTouch = (el, eventName, touchPosition) => { @@ -139,7 +139,7 @@ describe('DateTimePicker', () => { start: '2023-06-13' }, }); - expect(wrapper.vm.valueOfPicker).toStrictEqual(['10', '0', '0']) + expect(wrapper.vm.value).toStrictEqual('10:00:00') }) it(': start && end ', async () => { diff --git a/src/date-time-picker/date-time-picker.vue b/src/date-time-picker/date-time-picker.tsx similarity index 88% rename from src/date-time-picker/date-time-picker.vue rename to src/date-time-picker/date-time-picker.tsx index 4be7d610c..1f164c55e 100644 --- a/src/date-time-picker/date-time-picker.vue +++ b/src/date-time-picker/date-time-picker.tsx @@ -1,22 +1,8 @@ - - - diff --git a/src/date-time-picker/index.ts b/src/date-time-picker/index.ts index a094af096..2efe27cea 100644 --- a/src/date-time-picker/index.ts +++ b/src/date-time-picker/index.ts @@ -1,4 +1,4 @@ -import DateTimePicker from './date-time-picker.vue'; +import DateTimePicker from './date-time-picker'; import { withInstall, WithInstallType } from '../shared'; import './style'; diff --git a/src/picker/__test__/__snapshots__/demo.test.jsx.snap b/src/picker/__test__/__snapshots__/demo.test.jsx.snap index 627ca3b1d..fb2735d8c 100644 --- a/src/picker/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/picker/__test__/__snapshots__/demo.test.jsx.snap @@ -73,7 +73,9 @@ exports[`Picker > Picker areaVue demo works fine 1`] = `
+ > + +
@@ -262,7 +264,9 @@ exports[`Picker > Picker baseVue demo works fine 1`] = `
+ > + +
@@ -367,7 +371,9 @@ exports[`Picker > Picker baseVue demo works fine 1`] = `
+ > + +
@@ -808,7 +814,9 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
+ > + +
@@ -913,7 +921,9 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
+ > + +
@@ -1102,7 +1112,9 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
+ > + +
@@ -1305,7 +1317,9 @@ exports[`Picker > Picker mobileVue demo works fine 1`] = `
+ > + +
@@ -1485,7 +1499,9 @@ exports[`Picker > Picker titleVue demo works fine 1`] = `
+ > + +
diff --git a/src/picker/__test__/index.test.jsx b/src/picker/__test__/index.test.jsx index 05d288f78..589359c73 100644 --- a/src/picker/__test__/index.test.jsx +++ b/src/picker/__test__/index.test.jsx @@ -1,8 +1,8 @@ import { nextTick, ref } from 'vue'; import { mount } from '@vue/test-utils'; import { describe, it, expect, vi } from 'vitest'; -import Picker from '../picker.vue'; -import PickerItem from '../picker-item.vue'; +import Picker from '../picker'; +import PickerItem from '../picker-item'; import { DEFAULT_ITEM_HEIGHT, ANIMATION_TIME_LIMIT } from '../picker.class'; diff --git a/src/picker/cascade.vue b/src/picker/cascade.vue index 7ed4d5f2b..c5a49616d 100644 --- a/src/picker/cascade.vue +++ b/src/picker/cascade.vue @@ -10,7 +10,7 @@ import { computed, defineComponent, ref } from 'vue'; import config from '../config'; import PickerProps from './props'; import { PickerColumn, PickerValue } from './type'; -import Picker from './picker.vue'; +import Picker from './picker'; const { prefix } = config; const name = `${prefix}-cascade`; diff --git a/src/picker/index.ts b/src/picker/index.ts index 8d58416fd..95e1794d0 100644 --- a/src/picker/index.ts +++ b/src/picker/index.ts @@ -1,4 +1,4 @@ -import _Picker from './picker.vue'; +import _Picker from './picker'; import _Cascade from './cascade.vue'; import { withInstall, WithInstallType } from '../shared'; diff --git a/src/picker/picker-item.vue b/src/picker/picker-item.tsx similarity index 72% rename from src/picker/picker-item.vue rename to src/picker/picker-item.tsx index f83b898e0..4950acbbf 100644 --- a/src/picker/picker-item.vue +++ b/src/picker/picker-item.tsx @@ -1,12 +1,3 @@ - - - diff --git a/src/picker/picker.vue b/src/picker/picker.tsx similarity index 64% rename from src/picker/picker.vue rename to src/picker/picker.tsx index 3862d89e7..83ce38fea 100644 --- a/src/picker/picker.vue +++ b/src/picker/picker.tsx @@ -1,55 +1,31 @@ - - -