@tdesign/uniapp 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/action-sheet/README.en-US.md +4 -3
  3. package/dist/action-sheet/README.md +4 -3
  4. package/dist/action-sheet/action-sheet.vue +16 -12
  5. package/dist/action-sheet/computed.js +1 -1
  6. package/dist/action-sheet/props.ts +5 -0
  7. package/dist/action-sheet/type.ts +6 -1
  8. package/dist/avatar/README.en-US.md +1 -1
  9. package/dist/avatar/README.md +1 -1
  10. package/dist/avatar/avatar.vue +10 -9
  11. package/dist/avatar-group/avatar-group.vue +4 -4
  12. package/dist/back-top/README.en-US.md +1 -1
  13. package/dist/back-top/README.md +1 -1
  14. package/dist/back-top/back-top.vue +5 -4
  15. package/dist/badge/README.en-US.md +1 -1
  16. package/dist/badge/README.md +1 -1
  17. package/dist/badge/badge.vue +4 -2
  18. package/dist/button/README.en-US.md +1 -1
  19. package/dist/button/README.md +1 -1
  20. package/dist/button/button.vue +12 -11
  21. package/dist/calendar/README.en-US.md +1 -1
  22. package/dist/calendar/README.md +1 -1
  23. package/dist/calendar/calendar-header.vue +2 -1
  24. package/dist/calendar/calendar.vue +9 -7
  25. package/dist/calendar/template.vue +12 -9
  26. package/dist/cascader/README.en-US.md +1 -1
  27. package/dist/cascader/README.md +1 -1
  28. package/dist/cascader/cascader.vue +8 -8
  29. package/dist/cell/README.en-US.md +1 -1
  30. package/dist/cell/README.md +1 -1
  31. package/dist/cell/cell.vue +34 -36
  32. package/dist/cell-group/cell-group.vue +5 -3
  33. package/dist/check-tag/check-tag.vue +6 -3
  34. package/dist/checkbox/README.en-US.md +1 -1
  35. package/dist/checkbox/README.md +1 -1
  36. package/dist/checkbox/checkbox.vue +5 -4
  37. package/dist/checkbox-group/checkbox-group.vue +5 -3
  38. package/dist/col/col.vue +7 -3
  39. package/dist/collapse/README.en-US.md +1 -1
  40. package/dist/collapse/README.md +1 -1
  41. package/dist/collapse/collapse.vue +6 -4
  42. package/dist/collapse-panel/collapse-panel.vue +15 -6
  43. package/dist/color-picker/README.en-US.md +1 -1
  44. package/dist/color-picker/README.md +1 -1
  45. package/dist/color-picker/color-picker.vue +9 -7
  46. package/dist/color-picker/template.vue +2 -1
  47. package/dist/common/canvas/index.js +1 -1
  48. package/dist/common/shared/color-picker/color.js +1 -0
  49. package/dist/common/src/instantiationDecorator.js +1 -1
  50. package/dist/common/version.js +1 -1
  51. package/dist/config-provider/config-provider.vue +3 -1
  52. package/dist/count-down/README.en-US.md +1 -1
  53. package/dist/count-down/README.md +1 -1
  54. package/dist/count-down/count-down.vue +5 -3
  55. package/dist/date-time-picker/README.en-US.md +1 -1
  56. package/dist/date-time-picker/README.md +1 -1
  57. package/dist/date-time-picker/date-time-picker.vue +8 -6
  58. package/dist/date-time-picker/locale/dayjs.js +6 -6
  59. package/dist/demo-navbar/demo-navbar.vue +1 -1
  60. package/dist/dialog/README.en-US.md +1 -1
  61. package/dist/dialog/README.md +1 -1
  62. package/dist/dialog/dialog.vue +10 -7
  63. package/dist/dialog/index.js +2 -1
  64. package/dist/divider/README.en-US.md +1 -1
  65. package/dist/divider/README.md +1 -1
  66. package/dist/divider/divider.vue +4 -2
  67. package/dist/draggable/draggable.vue +5 -2
  68. package/dist/drawer/README.en-US.md +1 -1
  69. package/dist/drawer/README.md +1 -1
  70. package/dist/drawer/drawer.vue +7 -5
  71. package/dist/dropdown-item/dropdown-item.vue +14 -11
  72. package/dist/dropdown-menu/README.en-US.md +1 -1
  73. package/dist/dropdown-menu/README.md +1 -1
  74. package/dist/dropdown-menu/dropdown-menu.vue +10 -8
  75. package/dist/empty/README.en-US.md +1 -1
  76. package/dist/empty/README.md +1 -1
  77. package/dist/empty/empty.vue +5 -4
  78. package/dist/fab/README.en-US.md +1 -1
  79. package/dist/fab/README.md +1 -1
  80. package/dist/fab/fab.vue +7 -4
  81. package/dist/footer/README.en-US.md +1 -1
  82. package/dist/footer/README.md +1 -1
  83. package/dist/footer/footer.vue +8 -7
  84. package/dist/form/README.en-US.md +3 -1
  85. package/dist/form/README.md +3 -1
  86. package/dist/form/form.vue +4 -2
  87. package/dist/form/props.ts +9 -0
  88. package/dist/form/type.ts +5 -0
  89. package/dist/form-item/README.en-US.md +2 -1
  90. package/dist/form-item/README.md +2 -1
  91. package/dist/form-item/form-item.vue +8 -6
  92. package/dist/form-item/props.ts +8 -0
  93. package/dist/form-item/type.ts +4 -0
  94. package/dist/grid/README.en-US.md +1 -1
  95. package/dist/grid/README.md +1 -1
  96. package/dist/grid/grid.vue +4 -3
  97. package/dist/grid-item/README.en-US.md +1 -1
  98. package/dist/grid-item/README.md +1 -1
  99. package/dist/grid-item/grid-item.vue +8 -6
  100. package/dist/guide/README.en-US.md +1 -1
  101. package/dist/guide/README.md +1 -1
  102. package/dist/guide/guide.vue +8 -7
  103. package/dist/icon/icon.vue +5 -2
  104. package/dist/image/README.en-US.md +1 -1
  105. package/dist/image/README.md +1 -1
  106. package/dist/image/image.vue +6 -5
  107. package/dist/image-viewer/README.en-US.md +4 -3
  108. package/dist/image-viewer/README.md +4 -3
  109. package/dist/image-viewer/image-viewer.css +12 -0
  110. package/dist/image-viewer/image-viewer.vue +84 -21
  111. package/dist/image-viewer/props.ts +5 -0
  112. package/dist/image-viewer/type.ts +6 -1
  113. package/dist/indexes/README.en-US.md +1 -1
  114. package/dist/indexes/README.md +1 -1
  115. package/dist/indexes/indexes.vue +7 -4
  116. package/dist/indexes-anchor/README.en-US.md +1 -1
  117. package/dist/indexes-anchor/README.md +1 -1
  118. package/dist/indexes-anchor/indexes-anchor.vue +5 -3
  119. package/dist/input/README.en-US.md +1 -1
  120. package/dist/input/README.md +1 -1
  121. package/dist/input/input.vue +1 -1
  122. package/dist/link/README.en-US.md +1 -1
  123. package/dist/link/README.md +1 -1
  124. package/dist/link/link.vue +6 -3
  125. package/dist/loading/README.en-US.md +1 -1
  126. package/dist/loading/README.md +1 -1
  127. package/dist/loading/loading.vue +4 -2
  128. package/dist/message/index.js +2 -1
  129. package/dist/message/message.vue +4 -3
  130. package/dist/message-item/index.js +1 -1
  131. package/dist/message-item/message-item.vue +7 -5
  132. package/dist/mixins/page-scroll.js +1 -1
  133. package/dist/mixins/using-config.js +1 -1
  134. package/dist/mixins/using-custom-navbar.js +1 -1
  135. package/dist/navbar/README.en-US.md +1 -1
  136. package/dist/navbar/README.md +2 -2
  137. package/dist/navbar/navbar.vue +5 -4
  138. package/dist/notice-bar/README.en-US.md +1 -1
  139. package/dist/notice-bar/README.md +1 -1
  140. package/dist/notice-bar/notice-bar.vue +4 -3
  141. package/dist/overlay/README.en-US.md +1 -1
  142. package/dist/overlay/README.md +1 -1
  143. package/dist/overlay/overlay.vue +6 -3
  144. package/dist/picker/README.en-US.md +1 -1
  145. package/dist/picker/README.md +1 -1
  146. package/dist/picker/picker.vue +11 -9
  147. package/dist/picker-item/README.en-US.md +1 -1
  148. package/dist/picker-item/README.md +1 -1
  149. package/dist/picker-item/picker-item.vue +6 -5
  150. package/dist/popover/README.en-US.md +1 -1
  151. package/dist/popover/README.md +1 -1
  152. package/dist/popover/popover.vue +8 -5
  153. package/dist/popup/README.en-US.md +1 -1
  154. package/dist/popup/README.md +1 -1
  155. package/dist/popup/popup.vue +8 -5
  156. package/dist/progress/README.en-US.md +1 -1
  157. package/dist/progress/README.md +1 -1
  158. package/dist/progress/progress.vue +5 -4
  159. package/dist/pull-down-refresh/README.en-US.md +1 -1
  160. package/dist/pull-down-refresh/README.md +1 -1
  161. package/dist/pull-down-refresh/pull-down-refresh.vue +7 -5
  162. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +8 -7
  163. package/dist/qrcode/components/qrcode-status/qrcode-status.vue +2 -1
  164. package/dist/qrcode/qrcode.vue +5 -3
  165. package/dist/radio/README.en-US.md +1 -1
  166. package/dist/radio/README.md +1 -1
  167. package/dist/radio/radio.vue +5 -4
  168. package/dist/radio-group/radio-group.vue +5 -4
  169. package/dist/rate/README.en-US.md +1 -1
  170. package/dist/rate/README.md +1 -1
  171. package/dist/rate/rate.vue +8 -5
  172. package/dist/result/README.en-US.md +1 -1
  173. package/dist/result/README.md +1 -1
  174. package/dist/result/result.vue +5 -4
  175. package/dist/row/row.vue +7 -3
  176. package/dist/scroll-view/scroll-view.vue +1 -1
  177. package/dist/search/README.en-US.md +1 -1
  178. package/dist/search/README.md +1 -1
  179. package/dist/search/search.vue +14 -9
  180. package/dist/segmented/README.en-US.md +1 -1
  181. package/dist/segmented/README.md +1 -1
  182. package/dist/segmented/segmented.vue +6 -3
  183. package/dist/side-bar/README.en-US.md +1 -1
  184. package/dist/side-bar/README.md +1 -1
  185. package/dist/side-bar/side-bar.vue +5 -3
  186. package/dist/side-bar-item/side-bar-item.vue +7 -6
  187. package/dist/skeleton/README.en-US.md +1 -1
  188. package/dist/skeleton/README.md +1 -1
  189. package/dist/skeleton/skeleton.vue +6 -3
  190. package/dist/slider/README.en-US.md +1 -1
  191. package/dist/slider/README.md +1 -1
  192. package/dist/slider/slider.vue +7 -5
  193. package/dist/step-item/step-item.vue +5 -4
  194. package/dist/stepper/README.en-US.md +1 -1
  195. package/dist/stepper/README.md +1 -1
  196. package/dist/stepper/stepper.vue +5 -3
  197. package/dist/steps/README.en-US.md +1 -1
  198. package/dist/steps/README.md +1 -1
  199. package/dist/steps/steps.vue +5 -3
  200. package/dist/sticky/sticky.vue +4 -3
  201. package/dist/swipe-cell/swipe-cell.vue +7 -5
  202. package/dist/swiper/README.en-US.md +1 -1
  203. package/dist/swiper/README.md +1 -1
  204. package/dist/swiper/swiper.vue +7 -5
  205. package/dist/swiper-nav/swiper-nav.vue +6 -3
  206. package/dist/switch/README.en-US.md +1 -1
  207. package/dist/switch/README.md +1 -1
  208. package/dist/switch/switch.vue +5 -4
  209. package/dist/tab-bar/README.en-US.md +1 -1
  210. package/dist/tab-bar/README.md +1 -1
  211. package/dist/tab-bar/tab-bar.vue +5 -3
  212. package/dist/tab-bar-item/tab-bar-item.vue +6 -4
  213. package/dist/tab-panel/tab-panel.vue +5 -3
  214. package/dist/table/README.en-US.md +4 -4
  215. package/dist/table/README.md +4 -4
  216. package/dist/table/table.css +2 -2
  217. package/dist/table/table.vue +38 -7
  218. package/dist/tabs/README.en-US.md +1 -1
  219. package/dist/tabs/README.md +1 -1
  220. package/dist/tabs/tabs.vue +11 -9
  221. package/dist/tag/README.en-US.md +1 -1
  222. package/dist/tag/README.md +1 -1
  223. package/dist/tag/tag.vue +6 -3
  224. package/dist/textarea/README.en-US.md +1 -1
  225. package/dist/textarea/README.md +1 -1
  226. package/dist/textarea/textarea.vue +6 -3
  227. package/dist/toast/README.en-US.md +1 -1
  228. package/dist/toast/README.md +1 -1
  229. package/dist/toast/toast.vue +8 -7
  230. package/dist/transition/transition.vue +2 -2
  231. package/dist/tree-select/README.en-US.md +1 -1
  232. package/dist/tree-select/README.md +1 -1
  233. package/dist/tree-select/tree-select.vue +14 -9
  234. package/dist/types/action-sheet.d.ts +1 -1
  235. package/dist/types/avatar-group.d.ts +1 -1
  236. package/dist/types/avatar.d.ts +1 -1
  237. package/dist/types/back-top.d.ts +1 -1
  238. package/dist/types/badge.d.ts +1 -1
  239. package/dist/types/button.d.ts +1 -1
  240. package/dist/types/calendar.d.ts +1 -1
  241. package/dist/types/cascader.d.ts +1 -1
  242. package/dist/types/cell-group.d.ts +1 -1
  243. package/dist/types/cell.d.ts +1 -1
  244. package/dist/types/check-tag.d.ts +1 -1
  245. package/dist/types/checkbox-group.d.ts +1 -1
  246. package/dist/types/checkbox.d.ts +1 -1
  247. package/dist/types/col.d.ts +1 -1
  248. package/dist/types/collapse-panel.d.ts +1 -1
  249. package/dist/types/collapse.d.ts +1 -1
  250. package/dist/types/color-picker.d.ts +1 -1
  251. package/dist/upload/README.en-US.md +1 -1
  252. package/dist/upload/README.md +1 -1
  253. package/dist/upload/upload.vue +32 -32
  254. package/dist/watermark/README.en-US.md +1 -1
  255. package/dist/watermark/README.md +1 -1
  256. package/dist/watermark/utils/generateBase64Url.js +6 -6
  257. package/dist/watermark/watermark.vue +4 -3
  258. package/package.json +1 -1
@@ -118,17 +118,19 @@
118
118
  </view>
119
119
  </template>
120
120
  <script>
121
- import TImage from '../image/image';
122
- import TIcon from '../icon/icon';
123
121
  import TBadge from '../badge/badge';
124
122
 
125
- import { uniComponent } from '../common/src/index';
126
123
  import { prefix } from '../common/config';
127
- import props from './props';
124
+
125
+ import { ChildrenMixin, RELATION_MAP } from '../common/relation';
126
+ import { uniComponent } from '../common/src/index';
128
127
  import { uniqueFactory, setIcon } from '../common/utils';
129
- import { isObject } from '../common/validator';
130
128
  import tools from '../common/utils.wxs';
131
- import { ChildrenMixin, RELATION_MAP } from '../common/relation';
129
+ import { isObject } from '../common/validator';
130
+ import TIcon from '../icon/icon';
131
+ import TImage from '../image/image';
132
+
133
+ import props from './props';
132
134
 
133
135
 
134
136
  const name = `${prefix}-grid-item`;
@@ -70,7 +70,7 @@ title | String | - | title of current step | N
70
70
  ### CSS Variables
71
71
 
72
72
  The component provides the following CSS variables, which can be used to customize styles.
73
- Name | Default Value | Description
73
+ Name | Default Value | Description
74
74
  -- | -- | --
75
75
  --td-guide-body-color | @text-color-secondary | -
76
76
  --td-guide-dialog-body-font | @font-body-large | -
@@ -109,7 +109,7 @@ title | String | - | 当前步骤的标题内容,支持插槽:slot="title-{{
109
109
  ### CSS Variables
110
110
 
111
111
  组件提供了下列 CSS 变量,可用于自定义样式。
112
- 名称 | 默认值 | 描述
112
+ 名称 | 默认值 | 描述
113
113
  -- | -- | --
114
114
  --td-guide-body-color | @text-color-secondary | -
115
115
  --td-guide-dialog-body-font | @font-body-large | -
@@ -210,18 +210,19 @@
210
210
  </template>
211
211
 
212
212
  <script>
213
- import TOverlay from '../overlay/overlay';
214
- import TPopup from '../popup/popup';
215
- import { uniComponent } from '../common/src/index';
216
- import props from './props';
217
213
  import { prefix } from '../common/config';
218
- import { isFunction, isNumeric } from '../common/validator';
214
+ import { uniComponent } from '../common/src/index';
219
215
  import { debounce, getRect, rpx2px, styles, unitConvert, nextTick, systemInfo, coalesce } from '../common/utils';
216
+ import { isFunction, isNumeric } from '../common/validator';
217
+ import usingConfig from '../mixins/using-config';
218
+ import useCustomNavbar from '../mixins/using-custom-navbar';
219
+ import TOverlay from '../overlay/overlay';
220
+ import TPopup from '../popup/popup';
221
+
220
222
  import ContentComp from './content.vue';
223
+ import props from './props';
221
224
 
222
- import useCustomNavbar from '../mixins/using-custom-navbar';
223
225
 
224
- import usingConfig from '../mixins/using-config';
225
226
  const componentName = 'guide';
226
227
  const name = `${prefix}-${componentName}`;
227
228
 
@@ -24,12 +24,15 @@
24
24
  </view>
25
25
  </template>
26
26
  <script>
27
- import { uniComponent } from '../common/src/index';
28
27
  import { prefix } from '../common/config';
29
- import props from './props';
28
+ import { uniComponent } from '../common/src/index';
29
+
30
+
30
31
  import { styles, addUnit, getRect } from '../common/utils';
31
32
  import tools from '../common/utils.wxs';
32
33
 
34
+ import props from './props';
35
+
33
36
 
34
37
  const name = `${prefix}-icon`;
35
38
  export default {
@@ -43,7 +43,7 @@ t-class-load | \-
43
43
  ### CSS Variables
44
44
 
45
45
  The component provides the following CSS variables, which can be used to customize styles.
46
- Name | Default Value | Description
46
+ Name | Default Value | Description
47
47
  -- | -- | --
48
48
  --td-image-color | @text-color-placeholder | -
49
49
  --td-image-loading-bg-color | @bg-color-secondarycontainer | -
@@ -80,7 +80,7 @@ t-class-load | 加载样式类
80
80
  ### CSS Variables
81
81
 
82
82
  组件提供了下列 CSS 变量,可用于自定义样式。
83
- 名称 | 默认值 | 描述
83
+ 名称 | 默认值 | 描述
84
84
  -- | -- | --
85
85
  --td-image-color | @text-color-placeholder | -
86
86
  --td-image-loading-bg-color | @bg-color-secondarycontainer | -
@@ -83,14 +83,15 @@
83
83
  </view>
84
84
  </template>
85
85
  <script>
86
- import TLoading from '../loading/loading';
87
- import TIcon from '../icon/icon';
88
- import { uniComponent } from '../common/src/index';
89
- import ImageProps from './props';
90
86
  import { prefix } from '../common/config';
87
+ import { uniComponent } from '../common/src/index';
91
88
  import { addUnit, getRect, appBaseInfo } from '../common/utils';
92
- import { compareVersion } from '../common/version';
93
89
  import tools from '../common/utils.wxs';
90
+ import { compareVersion } from '../common/version';
91
+ import TIcon from '../icon/icon';
92
+ import TLoading from '../loading/loading';
93
+
94
+ import ImageProps from './props';
94
95
 
95
96
 
96
97
  const name = `${prefix}-image`;
@@ -14,10 +14,11 @@ image-props | Object | - | Typescript: `ImageProps`,[Image API Documents](./im
14
14
  images | Array | [] | Typescript: `Array<string>` | N
15
15
  initial-index | Number | 0 | Typescript: `Number` | N
16
16
  lazy | Boolean | true | \- | N
17
+ max-zoom | Number | 3 | \- | N
17
18
  show-index | Boolean | false | \- | N
18
19
  using-custom-navbar | Boolean | false | \- | N
19
- visible | Boolean | false | hide or show image viewer。`v-model:visible` is supported | N
20
- default-visible | Boolean | false | hide or show image viewer。uncontrolled property | N
20
+ visible | Boolean | false | hide or show image viewer。`v-model:visible` is supported。Typescript: `boolean \| null` | N
21
+ default-visible | Boolean | false | hide or show image viewer。uncontrolled property。Typescript: `boolean \| null` | N
21
22
 
22
23
  ### ImageViewer Events
23
24
 
@@ -37,7 +38,7 @@ delete-btn | \-
37
38
  ### CSS Variables
38
39
 
39
40
  The component provides the following CSS variables, which can be used to customize styles.
40
- Name | Default Value | Description
41
+ Name | Default Value | Description
41
42
  -- | -- | --
42
43
  --td-image-viewer-close-margin-left | @spacer-1 | -
43
44
  --td-image-viewer-delete-margin-right | @spacer-1 | -
@@ -45,10 +45,11 @@ image-props | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[
45
45
  images | Array | [] | 图片数组。TS 类型:`Array<string>` | N
46
46
  initial-index | Number | 0 | 初始化页码。TS 类型:`Number` | N
47
47
  lazy | Boolean | true | 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 | N
48
+ max-zoom | Number | 3 | 图片最大放大比例 | N
48
49
  show-index | Boolean | false | 是否显示页码 | N
49
50
  using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N
50
- visible | Boolean | false | 隐藏/显示预览。支持语法糖 `v-model:visible` | N
51
- default-visible | Boolean | false | 隐藏/显示预览。非受控属性 | N
51
+ visible | Boolean | false | 隐藏/显示预览。支持语法糖 `v-model:visible`。TS 类型:`boolean \| null` | N
52
+ default-visible | Boolean | false | 隐藏/显示预览。非受控属性。TS 类型:`boolean \| null` | N
52
53
 
53
54
  ### ImageViewer Events
54
55
 
@@ -68,7 +69,7 @@ delete-btn | 删除操作
68
69
  ### CSS Variables
69
70
 
70
71
  组件提供了下列 CSS 变量,可用于自定义样式。
71
- 名称 | 默认值 | 描述
72
+ 名称 | 默认值 | 描述
72
73
  -- | -- | --
73
74
  --td-image-viewer-close-margin-left | @spacer-1 | -
74
75
  --td-image-viewer-delete-margin-right | @spacer-1 | -
@@ -28,6 +28,18 @@
28
28
  .t-image-viewer .swiper {
29
29
  outline: 0;
30
30
  }
31
+ .t-image-viewer__movable-area {
32
+ width: 100%;
33
+ height: 100%;
34
+ overflow: hidden;
35
+ }
36
+ .t-image-viewer__movable-view {
37
+ width: 100%;
38
+ height: 100%;
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ }
31
43
  .t-image-viewer__image {
32
44
  width: 100%;
33
45
  display: inline-block;
@@ -7,7 +7,6 @@
7
7
  :aria-modal="true"
8
8
  aria-role="dialog"
9
9
  aria-label="图片查看器"
10
- @touchmove.stop.prevent="true"
11
10
  >
12
11
  <view
13
12
  :class="classPrefix + '__mask'"
@@ -15,6 +14,7 @@
15
14
  :style="'' + tools._style([backgroundColor && '--td-image-viewer-mask-bg-color: ' + backgroundColor])"
16
15
  aria-role="button"
17
16
  aria-label="关闭"
17
+ @touchmove.prevent="() => {}"
18
18
  @click="(e) => onClose(e, 'overlay')"
19
19
  />
20
20
  <block v-if="images && images.length">
@@ -33,21 +33,42 @@
33
33
  :key="index"
34
34
  :class="classPrefix + '__preview-image'"
35
35
  >
36
- <t-image
37
- v-if="!lazy || shouldLoadImage(index, currentSwiperIndex, loadedImageIndexes)"
38
- :t-class="prefix + '-image--external'"
39
- :class="classPrefix + '__image'"
40
- :custom-style="(imagesStyle[index] && imagesStyle[index].style) || ''"
41
- :data-index="index"
42
- :src="item"
43
- :mode="(imageProps && imageProps.mode) || 'aspectFit'"
44
- :lazy="(imageProps && imageProps.lazy) || false"
45
- :loading="(imageProps && imageProps.loading) || 'default'"
46
- :shape="(imageProps && imageProps.shape) || 'square'"
47
- :webp="(imageProps && imageProps.webp) || false"
48
- :show-menu-by-longpress="(imageProps && imageProps.showMenuByLongpress) || false"
49
- @load="(e) => onImageLoadSuccess(e, { index })"
50
- />
36
+ <movable-area
37
+ :class="classPrefix + '__movable-area'"
38
+ scale-area
39
+ @touchmove="onAreaTouchMove"
40
+ >
41
+ <movable-view
42
+ :class="classPrefix + '__movable-view'"
43
+ direction="all"
44
+ :scale="true"
45
+ :scale-min="1"
46
+ :scale-max="maxZoom"
47
+ :scale-value="index === currentSwiperIndex ? currentScale : 1"
48
+ :damping="100"
49
+ :friction="20"
50
+ :out-of-bounds="false"
51
+ :disabled="false"
52
+ @scale="onMovableScale"
53
+ @tap.stop="onImageDoubleTap(index)"
54
+ >
55
+ <t-image
56
+ v-if="!lazy || shouldLoadImage(index, currentSwiperIndex, loadedImageIndexes)"
57
+ :t-class="prefix + '-image--external'"
58
+ :class="classPrefix + '__image'"
59
+ :custom-style="(imagesStyle[index] && imagesStyle[index].style) || ''"
60
+ :data-index="index"
61
+ :src="item"
62
+ :mode="(imageProps && imageProps.mode) || 'aspectFit'"
63
+ :lazy="(imageProps && imageProps.lazy) || false"
64
+ :loading="(imageProps && imageProps.loading) || 'default'"
65
+ :shape="(imageProps && imageProps.shape) || 'square'"
66
+ :webp="(imageProps && imageProps.webp) || false"
67
+ :show-menu-by-longpress="(imageProps && imageProps.showMenuByLongpress) || false"
68
+ @load="(e) => onImageLoadSuccess(e, { index })"
69
+ />
70
+ </movable-view>
71
+ </movable-area>
51
72
  </swiper-item>
52
73
  </swiper>
53
74
  </view>
@@ -111,16 +132,21 @@
111
132
  </view>
112
133
  </template>
113
134
  <script>
114
- import TImage from '../image/image';
115
- import TIcon from '../icon/icon';
135
+ import { prefix } from '../common/config';
116
136
  import { uniComponent } from '../common/src/index';
117
137
  import { styles, calcIcon, systemInfo } from '../common/utils';
118
- import { prefix } from '../common/config';
119
- import props from './props';
138
+
139
+
120
140
  import tools from '../common/utils.wxs';
121
- import { shouldLoadImage } from './computed.js';
141
+ import TIcon from '../icon/icon';
142
+ import TImage from '../image/image';
143
+
144
+
122
145
  import useCustomNavbar from '../mixins/using-custom-navbar';
123
146
 
147
+ import { shouldLoadImage } from './computed.js';
148
+ import props from './props';
149
+
124
150
 
125
151
  const name = `${prefix}-image-viewer`;
126
152
 
@@ -161,6 +187,8 @@ export default {
161
187
  iDeleteBtn: null,
162
188
  iCloseBtn: null,
163
189
  dataVisible: this.visible,
190
+ currentScale: 1,
191
+ lastTapTime: 0,
164
192
  };
165
193
  },
166
194
  watch: {
@@ -297,11 +325,46 @@ export default {
297
325
  const {
298
326
  detail: { current },
299
327
  } = e;
328
+ // 切换图片时重置缩放,避免上一张的缩放状态影响当前图
329
+ this.currentScale = 1;
300
330
  this.currentSwiperIndex = current;
301
331
 
302
332
  this._trigger('change', { index: current });
303
333
  },
304
334
 
335
+ onMovableScale(e) {
336
+ const scale = e?.detail?.scale ?? 1;
337
+ this.currentScale = scale;
338
+ },
339
+
340
+ onAreaTouchMove(e) {
341
+ // 当图片处于缩放状态时,阻止 touchmove 冒泡到 swiper,避免误触翻页(H5 端兜底)
342
+ // movable-view 自身仍会响应拖动/pinch,不受影响
343
+ // 注:小程序端原生 swiper 滑动手势底层接管,stopPropagation 无效,留作平台限制
344
+ if (this.currentScale > 1) {
345
+ if (e && typeof e.stopPropagation === 'function') {
346
+ e.stopPropagation();
347
+ }
348
+ if (e && typeof e.preventDefault === 'function') {
349
+ e.preventDefault();
350
+ }
351
+ }
352
+ },
353
+
354
+ onImageDoubleTap(index) {
355
+ // 仅响应当前图片,避免影响其它 swiper-item
356
+ if (index !== this.currentSwiperIndex) return;
357
+ const now = Date.now();
358
+ if (now - this.lastTapTime < 300) {
359
+ // 双击:在 1 与 maxZoom 之间切换
360
+ const max = Number(this.maxZoom) || 3;
361
+ this.currentScale = this.currentScale > 1 ? 1 : max;
362
+ this.lastTapTime = 0;
363
+ } else {
364
+ this.lastTapTime = now;
365
+ }
366
+ },
367
+
305
368
  onClose(e, source) {
306
369
  this._trigger('close', { visible: false, trigger: source || 'button', index: this.currentSwiperIndex });
307
370
  },
@@ -40,6 +40,11 @@ export default {
40
40
  type: Boolean,
41
41
  default: true,
42
42
  },
43
+ /** 图片最大放大比例 */
44
+ maxZoom: {
45
+ type: Number,
46
+ default: 3,
47
+ },
43
48
  /** 是否显示页码 */
44
49
  showIndex: Boolean,
45
50
  /** 是否使用了自定义导航栏 */
@@ -41,6 +41,11 @@ export interface TdImageViewerProps {
41
41
  * @default true
42
42
  */
43
43
  lazy?: boolean;
44
+ /**
45
+ * 图片最大放大比例
46
+ * @default 3
47
+ */
48
+ maxZoom?: number;
44
49
  /**
45
50
  * 是否显示页码
46
51
  * @default false
@@ -60,7 +65,7 @@ export interface TdImageViewerProps {
60
65
  * 隐藏/显示预览,非受控属性
61
66
  * @default false
62
67
  */
63
- defaultVisible?: boolean;
68
+ defaultVisible?: boolean | null;
64
69
  /**
65
70
  * 翻页时回调
66
71
  */
@@ -52,7 +52,7 @@ t-class-sidebar-item | \-
52
52
  ### CSS Variables
53
53
 
54
54
  The component provides the following CSS variables, which can be used to customize styles.
55
- Name | Default Value | Description
55
+ Name | Default Value | Description
56
56
  -- | -- | --
57
57
  --td-indexes-sidebar-active-bg-color | @brand-color | -
58
58
  --td-indexes-sidebar-active-color | @text-color-anti | -
@@ -83,7 +83,7 @@ t-class-sidebar-item | 侧边栏选项样式类
83
83
  ### CSS Variables
84
84
 
85
85
  组件提供了下列 CSS 变量,可用于自定义样式。
86
- 名称 | 默认值 | 描述
86
+ 名称 | 默认值 | 描述
87
87
  -- | -- | --
88
88
  --td-indexes-sidebar-active-bg-color | @brand-color | -
89
89
  --td-indexes-sidebar-active-color | @text-color-anti | -
@@ -38,14 +38,17 @@
38
38
  </template>
39
39
  <script>
40
40
 
41
- import { uniComponent } from '../common/src/index';
42
41
  import { prefix } from '../common/config';
43
- import props from './props';
42
+ import { ParentMixin, RELATION_MAP } from '../common/relation';
43
+ import { uniComponent } from '../common/src/index';
44
+
45
+
44
46
  import { getRect, throttle, systemInfo } from '../common/utils';
45
- import pageScrollMixin from '../mixins/page-scroll';
46
47
  import tools from '../common/utils.wxs';
48
+ import pageScrollMixin from '../mixins/page-scroll';
49
+
47
50
  import { getFirstCharacter } from './computed.js';
48
- import { ParentMixin, RELATION_MAP } from '../common/relation';
51
+ import props from './props';
49
52
 
50
53
 
51
54
  const name = `${prefix}-indexes`;
@@ -11,7 +11,7 @@ index | String / Number | - | \- | N
11
11
  ### CSS Variables
12
12
 
13
13
  The component provides the following CSS variables, which can be used to customize styles.
14
- Name | Default Value | Description
14
+ Name | Default Value | Description
15
15
  -- | -- | --
16
16
  --td-indexes-anchor-active-bg-color | @bg-color-container | -
17
17
  --td-indexes-anchor-active-color | @brand-color | -
@@ -15,7 +15,7 @@ t-class | 根节点样式类
15
15
  ### CSS Variables
16
16
 
17
17
  组件提供了下列 CSS 变量,可用于自定义样式。
18
- 名称 | 默认值 | 描述
18
+ 名称 | 默认值 | 描述
19
19
  -- | -- | --
20
20
  --td-indexes-anchor-active-bg-color | @bg-color-container | -
21
21
  --td-indexes-anchor-active-color | @brand-color | -
@@ -20,11 +20,13 @@
20
20
  </view>
21
21
  </template>
22
22
  <script>
23
- import { uniComponent } from '../common/src/index';
24
23
  import { prefix } from '../common/config';
25
- import props from './props';
26
- import tools from '../common/utils.wxs';
27
24
  import { ChildrenMixin, RELATION_MAP } from '../common/relation';
25
+ import { uniComponent } from '../common/src/index';
26
+
27
+ import tools from '../common/utils.wxs';
28
+
29
+ import props from './props';
28
30
 
29
31
 
30
32
  const name = `${prefix}-indexes-anchor`;
@@ -93,7 +93,7 @@ t-class-tips | \-
93
93
  ### CSS Variables
94
94
 
95
95
  The component provides the following CSS variables, which can be used to customize styles.
96
- Name | Default Value | Description
96
+ Name | Default Value | Description
97
97
  -- | -- | --
98
98
  --td-input-align-items | center | -
99
99
  --td-input-bg-color | @bg-color-container | -
@@ -164,7 +164,7 @@ t-class-tips | 提示样式类
164
164
  ### CSS Variables
165
165
 
166
166
  组件提供了下列 CSS 变量,可用于自定义样式。
167
- 名称 | 默认值 | 描述
167
+ 名称 | 默认值 | 描述
168
168
  -- | -- | --
169
169
  --td-input-align-items | center | -
170
170
  --td-input-bg-color | @bg-color-container | -
@@ -305,8 +305,8 @@ export default {
305
305
  },
306
306
 
307
307
  emitChange(data) {
308
- this.$emit('change', data);
309
308
  this.$emit('update:value', data.value);
309
+ this.$emit('change', data);
310
310
  },
311
311
 
312
312
  onFocus(e) {
@@ -48,7 +48,7 @@ t-class-suffix-icon | \-
48
48
  ### CSS Variables
49
49
 
50
50
  The component provides the following CSS variables, which can be used to customize styles.
51
- Name | Default Value | Description
51
+ Name | Default Value | Description
52
52
  -- | -- | --
53
53
  --td-link-danger-active-color | @error-color-active | -
54
54
  --td-link-danger-color | @error-color | -
@@ -98,7 +98,7 @@ t-class-suffix-icon | 后置图标样式类
98
98
  ### CSS Variables
99
99
 
100
100
  组件提供了下列 CSS 变量,可用于自定义样式。
101
- 名称 | 默认值 | 描述
101
+ 名称 | 默认值 | 描述
102
102
  -- | -- | --
103
103
  --td-link-danger-active-color | @error-color-active | -
104
104
  --td-link-danger-color | @error-color | -
@@ -72,12 +72,15 @@
72
72
  </view>
73
73
  </template>
74
74
  <script>
75
- import TIcon from '../icon/icon';
76
- import { uniComponent } from '../common/src/index';
77
75
  import { prefix } from '../common/config';
78
- import props from './props';
76
+ import { uniComponent } from '../common/src/index';
77
+
78
+
79
79
  import { calcIcon, coalesce } from '../common/utils';
80
80
  import tools from '../common/utils.wxs';
81
+ import TIcon from '../icon/icon';
82
+
83
+ import props from './props';
81
84
 
82
85
 
83
86
  const name = `${prefix}-link`;
@@ -40,7 +40,7 @@ t-class-text | \-
40
40
  ### CSS Variables
41
41
 
42
42
  The component provides the following CSS variables, which can be used to customize styles.
43
- Name | Default Value | Description
43
+ Name | Default Value | Description
44
44
  -- | -- | --
45
45
  --td-loading-color | @brand-color | -
46
46
  --td-loading-full-bg-color | rgba(255, 255, 255, 0.6) | -
@@ -89,7 +89,7 @@ t-class-text | 文本样式类
89
89
  ### CSS Variables
90
90
 
91
91
  组件提供了下列 CSS 变量,可用于自定义样式。
92
- 名称 | 默认值 | 描述
92
+ 名称 | 默认值 | 描述
93
93
  -- | -- | --
94
94
  --td-loading-color | @brand-color | -
95
95
  --td-loading-full-bg-color | rgba(255, 255, 255, 0.6) | -
@@ -88,11 +88,13 @@
88
88
  </view>
89
89
  </template>
90
90
  <script>
91
- import { uniComponent } from '../common/src/index';
92
91
  import { prefix } from '../common/config';
93
- import props from './props';
92
+ import { uniComponent } from '../common/src/index';
93
+
94
94
  import tools from '../common/utils.wxs';
95
95
 
96
+ import props from './props';
97
+
96
98
 
97
99
  const name = `${prefix}-loading`;
98
100
 
@@ -1,6 +1,7 @@
1
- import { MessageType } from './message.interface';
2
1
  import { getInstance } from '../common/utils';
3
2
 
3
+ import { MessageType } from './message.interface';
4
+
4
5
 
5
6
  const showMessage = function (options, theme = MessageType.info) {
6
7
  const { context, selector = '#t-message', ...otherOptions } = options;
@@ -34,12 +34,13 @@
34
34
  </template>
35
35
 
36
36
  <script>
37
- import TMessageItem from '../message-item/message-item.vue';
38
- import { uniComponent } from '../common/src/index';
39
37
  import { prefix } from '../common/config';
38
+ import { uniComponent } from '../common/src/index';
39
+ import { unitConvert } from '../common/utils';
40
+ import TMessageItem from '../message-item/message-item.vue';
41
+
40
42
  import { MessageType } from './message.interface';
41
43
  import props from './props';
42
- import { unitConvert } from '../common/utils';
43
44
 
44
45
 
45
46
  const SHOW_DURATION = 400;
@@ -1,5 +1,5 @@
1
- import { MessageType } from '../message/message.interface';
2
1
  import { getInstance } from '../common/utils';
2
+ import { MessageType } from '../message/message.interface';
3
3
 
4
4
 
5
5
  const showMessage = function (options, theme = MessageType.info) {
@@ -89,16 +89,18 @@
89
89
  </view>
90
90
  </template>
91
91
  <script>
92
- import TIcon from '../icon/icon';
93
- import TLink from '../link/link';
94
- import { uniComponent } from '../common/src/index';
95
92
  import { prefix } from '../common/config';
93
+ import { uniComponent } from '../common/src/index';
96
94
  import { getRect, unitConvert, calcIcon } from '../common/utils';
97
- import { isObject } from '../common/validator';
98
95
  import tools from '../common/utils.wxs';
99
- import { getMessageStyles } from './computed.js';
96
+ import { isObject } from '../common/validator';
97
+ import TIcon from '../icon/icon';
98
+ import TLink from '../link/link';
99
+
100
100
  import { messageDefaultData } from '../message/config';
101
101
 
102
+ import { getMessageStyles } from './computed.js';
103
+
102
104
 
103
105
  const SHOW_DURATION = 400;
104
106
  const name = `${prefix}-message`;
@@ -1,5 +1,5 @@
1
- import { getCurrentPage } from '../common/utils';
2
1
  import Bus from '../common/bus';
2
+ import { getCurrentPage } from '../common/utils';
3
3
 
4
4
  const overflowScrollReg = /scroll|auto|overlay/i;
5
5