diff --git a/src/_common b/src/_common index 0a709515d..a2a5496ea 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 0a709515dd1bdebc42e18f4224c6b99395b01a55 +Subproject commit a2a5496ea3a2769b9d33b64b063b85fa6bab5b18 diff --git a/src/loading/__test__/__snapshots__/demo.test.jsx.snap b/src/loading/__test__/__snapshots__/demo.test.jsx.snap index cca86f152..4b71c6da7 100644 --- a/src/loading/__test__/__snapshots__/demo.test.jsx.snap +++ b/src/loading/__test__/__snapshots__/demo.test.jsx.snap @@ -1,34 +1,5 @@ // Vitest Snapshot v1 -exports[`Loading > Loading barVue demo works fine 1`] = ` -
- -
- -
- - -
-`; - exports[`Loading > Loading baseVue demo works fine 1`] = `
Loading baseVue demo works fine 1`] = `
- Loading baseVue demo works fine 1`] = ` -
- Loading baseVue demo works fine 1`] = ` -
-
+ > +
+
+
+
-
@@ -174,13 +152,11 @@ exports[`Loading > Loading delayVue demo works fine 1`] = `
- -
@@ -194,10 +170,9 @@ exports[`Loading > Loading horzVue demo works fine 1`] = `
- Loading horzVue demo works fine 1`] = ` 加载中... -
- Loading horzVue demo works fine 1`] = ` 加载中... -
@@ -314,12 +286,12 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- 01 类型 + 01 组件类型

- 纯icon + 纯图标

Loading mobileVue demo works fine 1`] = `
- Loading mobileVue demo works fine 1`] = ` -
- Loading mobileVue demo works fine 1`] = ` -
-
+ > +
+
+
+
-
@@ -442,7 +421,7 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- icon加文字横向 + 图标加文字横向

Loading mobileVue demo works fine 1`] = `
- Loading mobileVue demo works fine 1`] = ` 加载中... -
- Loading mobileVue demo works fine 1`] = ` 加载中... -
@@ -557,7 +532,7 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- icon加文字竖向 + 图标加文字竖向

Loading mobileVue demo works fine 1`] = ` data-v-448d2bed="" >
- Loading mobileVue demo works fine 1`] = ` 加载中 -
-
-
- -
-
- -

- 纯文字 -

- -
-
- - 加载中... + + + + + + + + + + + + + + - - -
-
- - - - 加载失败 + 加载中... - -
-
- - - - -
- 加载失败 - - 刷新 - -
- -
@@ -693,35 +647,26 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- 进度条加载 + 纯文字

-
-
- - + +
@@ -732,13 +677,9 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- 02 状态 + 02 组件尺寸

-

- 如果加载状态在延迟内结束,则不显示 -

+
Loading mobileVue demo works fine 1`] = ` >
-
+
+ + -
- - -
-
-
-
+ + + + - 请求结束,隐藏loading -
+ 加载中... + + +
+
+ 中尺寸
- - + + +
+ + + + + 加载中... + +
+
+ 小尺寸 +
+
+ + + +
+ + + + 加载中... + +
@@ -797,7 +822,7 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `

- 加载速度可配置,加载一周的时间单位(毫秒) + 加载速度调整

Loading mobileVue demo works fine 1`] = `
- Loading mobileVue demo works fine 1`] = ` 加载中... -
- - 速度调整 -
-
- 0 -
+
@@ -870,13 +883,13 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `
@@ -888,228 +901,47 @@ exports[`Loading > Loading mobileVue demo works fine 1`] = `
-
- 800 -
+
-
-

- 04 规格 -

-

- 支持自定义加载规格 -

- -
-
-
- - - - -
- - - - - 加载中(小)... - - - -
-
- - - - -
- - - - - 加载中(中)... - - - -
-
- - - - -
- - - - - 加载中(大)... - - - -
- - - - `; exports[`Loading > Loading pureTextVue demo works fine 1`] = `
-
- - - - 加载中... - - - -
-
+ - - - - - - 加载失败 - - - -
-
- - - - -
- 加载失败 - - 刷新 - -
- - -
+ 加载中... + +
`; exports[`Loading > Loading sizeVue demo works fine 1`] = `
+
- + 大尺寸 +
+
Loading sizeVue demo works fine 1`] = ` - 加载中(小)... + 加载中... -
- + 中尺寸 +
+
Loading sizeVue demo works fine 1`] = ` - 加载中(中)... + 加载中... -
- + 小尺寸 +
+
Loading sizeVue demo works fine 1`] = ` - 加载中(大)... + 加载中... -
+
`; @@ -1223,14 +1063,13 @@ exports[`Loading > Loading speedVue demo works fine 1`] = `
- Loading speedVue demo works fine 1`] = ` 加载中... -
- - 速度调整 -
-
- 0 -
+
@@ -1285,13 +1113,13 @@ exports[`Loading > Loading speedVue demo works fine 1`] = `
@@ -1303,11 +1131,7 @@ exports[`Loading > Loading speedVue demo works fine 1`] = `
-
- 800 -
+
@@ -1315,13 +1139,16 @@ exports[`Loading > Loading speedVue demo works fine 1`] = ` `; exports[`Loading > Loading vertVue demo works fine 1`] = ` -
+
- Loading vertVue demo works fine 1`] = ` 加载中 +
+
+ + + + + + + + + + + + + + + + + + + 加载中... + +
`; diff --git a/src/loading/__test__/__snapshots__/index.test.jsx.snap b/src/loading/__test__/__snapshots__/index.test.jsx.snap index dd00f5191..201914b5c 100644 --- a/src/loading/__test__/__snapshots__/index.test.jsx.snap +++ b/src/loading/__test__/__snapshots__/index.test.jsx.snap @@ -3,10 +3,9 @@ exports[`Loading.vue > props > :pause 1`] = `
- props > :pause 1`] = ` -
`; exports[`Loading.vue > props > :reverse 1`] = `
- props > :reverse 1`] = ` -
`; diff --git a/src/loading/__test__/demo.test.jsx b/src/loading/__test__/demo.test.jsx index 61173f186..1eff088ac 100644 --- a/src/loading/__test__/demo.test.jsx +++ b/src/loading/__test__/demo.test.jsx @@ -3,7 +3,6 @@ */ import { mount } from '@vue/test-utils'; -import barVue from '@/loading/demos/bar.vue'; import baseVue from '@/loading/demos/base.vue'; import delayVue from '@/loading/demos/delay.vue'; import horzVue from '@/loading/demos/horz.vue'; @@ -14,7 +13,6 @@ import speedVue from '@/loading/demos/speed.vue'; import vertVue from '@/loading/demos/vert.vue'; const mapper = { - barVue, baseVue, delayVue, horzVue, diff --git a/src/loading/__test__/index.test.jsx b/src/loading/__test__/index.test.jsx index 77425a734..b87029f29 100644 --- a/src/loading/__test__/index.test.jsx +++ b/src/loading/__test__/index.test.jsx @@ -14,13 +14,6 @@ describe('Loading.vue', () => { vi.restoreAllMocks(); }); - it(':progress', () => { - const wrapper = mount(() => ); - - const shadow = wrapper.find('.t-loading__shadow'); - expect(shadow.exists()).toBeTruthy(); - }); - it(':delay', async () => { const wrapper = mount(() => ); expect(wrapper.find('.t-icon-loading').exists()).not.toBeTruthy(); @@ -29,19 +22,13 @@ describe('Loading.vue', () => { expect(wrapper.find('.t-icon-loading').exists()).toBeTruthy(); }); - it(':error', () => { - const wrapper = mount(() => ); - const errorBlock = wrapper.find('.t-loading__text'); - expect(errorBlock.element.innerHTML).toBe('加载失败'); - }); - it(':inheritColor', () => { const wrapper = mount(Loading, { props: { inheritColor: true, }, }); - expect(wrapper.vm.rootStyle).toBe('color: inherit'); + expect(wrapper.vm.rootStyle).toContain('color: inherit'); }); it(':pause', () => { diff --git a/src/loading/demos/bar.vue b/src/loading/demos/bar.vue deleted file mode 100644 index 53fb3e0d8..000000000 --- a/src/loading/demos/bar.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/src/loading/demos/base.vue b/src/loading/demos/base.vue index 43ddab4af..b6b0a4de5 100644 --- a/src/loading/demos/base.vue +++ b/src/loading/demos/base.vue @@ -6,6 +6,6 @@ diff --git a/src/loading/demos/mobile.vue b/src/loading/demos/mobile.vue index a2a1409fd..04e45cca3 100644 --- a/src/loading/demos/mobile.vue +++ b/src/loading/demos/mobile.vue @@ -2,17 +2,17 @@

Loading 加载中

用于表示页面或操作的加载状态,给予用户反馈的同时减缓等待的焦虑感,由一个或一组反馈动效组成。

- +
- +
- +
@@ -22,37 +22,24 @@
- -
- -
-
- +
- +
- +
- -
- -
-
diff --git a/src/loading/demos/pure-text.vue b/src/loading/demos/pure-text.vue index bd1a77b9c..751c42b34 100644 --- a/src/loading/demos/pure-text.vue +++ b/src/loading/demos/pure-text.vue @@ -1,30 +1,3 @@ - - - - diff --git a/src/loading/demos/size.vue b/src/loading/demos/size.vue index 09ed9659d..e1652f49d 100644 --- a/src/loading/demos/size.vue +++ b/src/loading/demos/size.vue @@ -1,15 +1,16 @@ diff --git a/src/loading/demos/speed.vue b/src/loading/demos/speed.vue index 6fa6e7d2f..a2ad17d39 100644 --- a/src/loading/demos/speed.vue +++ b/src/loading/demos/speed.vue @@ -1,15 +1,14 @@ diff --git a/src/loading/loading.en-US.md b/src/loading/loading.en-US.md new file mode 100644 index 000000000..c3cd950e0 --- /dev/null +++ b/src/loading/loading.en-US.md @@ -0,0 +1,21 @@ +:: BASE_DOC :: + +## API +### Loading Props + +name | type | default | description | required +-- | -- | -- | -- | -- +content | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +default | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +delay | Number | 0 | \- | N +duration | Number | 800 | \- | N +indicator | Boolean | true | \- | N +inheritColor | Boolean | false | \- | N +layout | String | horizontal | options:horizontal/vertical | N +loading | Boolean | true | \- | N +pause | Boolean | false | \- | N +progress | Number | - | \- | N +reverse | Boolean | - | \- | N +size | String | '20px' | \- | N +text | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +theme | String | circular | options:circular/spinner/dots | N diff --git a/src/loading/loading.md b/src/loading/loading.md index 0bb46083b..6fc6b2502 100644 --- a/src/loading/loading.md +++ b/src/loading/loading.md @@ -1,22 +1,21 @@ :: BASE_DOC :: ## API - ### Loading Props -| 名称 | 类型 | 默认值 | 说明 | 必传 | -| ------------ | ------------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---- | -| default | String / Slot / Function | - | 子元素,同 content。TS 类型:`string | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N | -| delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N | -| content | String / Slot / Function | - | 子元素。TS 类型:`string | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N | -| duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N | -| indicator | Boolean | true | 是否显示加载指示符 | N | -| inheritColor | Boolean | false | 是否继承父元素颜色 | N | -| layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N | -| loading | Boolean | true | 是否处于加载状态 | N | -| pause | Boolean | false | 是否暂停动画 | N | -| progress | Number | - | 加载进度 | N | -| reverse | Boolean | - | 加载动画是否反向 | N | -| size | String | '40rpx' | 尺寸,示例:40rpx/20px | N | -| text | String / Slot | - | 加载提示文案 | N | -| theme | String | circular | 加载组件类型。可选项:circular/spinner/bar/error/dots | N | +名称 | 类型 | 默认值 | 说明 | 必传 +-- | -- | -- | -- | -- +content | String / Slot / Function | - | 子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +default | String / Slot / Function | - | 子元素,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N +duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N +indicator | Boolean | true | 是否显示加载指示符 | N +inheritColor | Boolean | false | 是否继承父元素颜色 | N +layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N +loading | Boolean | true | 是否处于加载状态 | N +pause | Boolean | false | 是否暂停动画 | N +progress | Number | - | 加载进度 | N +reverse | Boolean | - | 加载动画是否反向 | N +size | String | '20px' | 尺寸,示例:20px | N +text | String / Slot / Function | - | 加载提示文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +theme | String | circular | 加载组件类型。可选项:circular/spinner/dots | N diff --git a/src/loading/loading.vue b/src/loading/loading.vue index 73904f57f..6342fda2f 100644 --- a/src/loading/loading.vue +++ b/src/loading/loading.vue @@ -1,19 +1,27 @@