vite-uni-dev-tool 0.0.48 → 1.0.0

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 (292) hide show
  1. package/README.md +20 -0
  2. package/dist/const.cjs +1 -0
  3. package/dist/const.d.ts +78 -161
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -47
  6. package/dist/core-shared.d.ts +44 -0
  7. package/dist/core-shared.d.ts.map +1 -0
  8. package/dist/core-shared.js +1 -0
  9. package/dist/core.d.ts +2 -40
  10. package/dist/core.d.ts.map +1 -1
  11. package/dist/core.js +4 -159
  12. package/dist/i18n/index.cjs +1 -0
  13. package/dist/i18n/index.d.ts +9 -0
  14. package/dist/i18n/index.d.ts.map +1 -0
  15. package/dist/i18n/index.js +1 -0
  16. package/dist/i18n/instance.cjs +1 -0
  17. package/dist/i18n/instance.d.ts +15 -0
  18. package/dist/i18n/instance.d.ts.map +1 -0
  19. package/dist/i18n/instance.js +1 -0
  20. package/dist/i18n/locales/en.cjs +1 -0
  21. package/dist/i18n/locales/en.d.ts +470 -0
  22. package/dist/i18n/locales/en.d.ts.map +1 -0
  23. package/dist/i18n/locales/en.js +1 -0
  24. package/dist/i18n/locales/zh-Hans.cjs +1 -0
  25. package/dist/i18n/locales/zh-Hans.d.ts +476 -0
  26. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -0
  27. package/dist/i18n/locales/zh-Hans.js +1 -0
  28. package/dist/index.cjs +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/modules/devConsole/index.cjs +4 -0
  32. package/dist/{devConsole → modules/devConsole}/index.d.ts +1 -1
  33. package/dist/modules/devConsole/index.d.ts.map +1 -0
  34. package/dist/modules/devConsole/index.js +4 -0
  35. package/dist/modules/devEvent/index.cjs +5 -0
  36. package/dist/modules/devEvent/index.d.ts +115 -0
  37. package/dist/modules/devEvent/index.d.ts.map +1 -0
  38. package/dist/modules/devEvent/index.js +5 -0
  39. package/dist/modules/devIntercept/index.cjs +13 -0
  40. package/dist/modules/devIntercept/index.d.ts +71 -0
  41. package/dist/modules/devIntercept/index.d.ts.map +1 -0
  42. package/dist/modules/devIntercept/index.js +13 -0
  43. package/dist/modules/devStore/index.cjs +1 -0
  44. package/dist/modules/devStore/index.d.ts +159 -0
  45. package/dist/modules/devStore/index.d.ts.map +1 -0
  46. package/dist/modules/devStore/index.js +1 -0
  47. package/dist/modules/devToolInfo/index.cjs +1 -0
  48. package/dist/modules/devToolInfo/index.d.ts +27 -0
  49. package/dist/modules/devToolInfo/index.d.ts.map +1 -0
  50. package/dist/modules/devToolInfo/index.js +1 -0
  51. package/dist/plugins/uniDevTool/transform/transformApp.cjs +44 -0
  52. package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -1
  53. package/dist/plugins/uniDevTool/transform/transformApp.js +17 -17
  54. package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -0
  55. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
  56. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
  57. package/dist/plugins/uniDevTool/transform/transformVue.cjs +41 -0
  58. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +1 -2
  59. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
  60. package/dist/plugins/uniDevTool/transform/transformVue.js +32 -19
  61. package/dist/plugins/uniDevTool/uniDevTool.cjs +5 -0
  62. package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -11
  63. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  64. package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
  65. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.cjs +19 -0
  66. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +1 -1
  67. package/dist/plugins/uniGlobalComponents/uniGlobalComponents.js +11 -19
  68. package/dist/plugins/uniParseStock/index.d.ts +10 -0
  69. package/dist/plugins/uniParseStock/index.d.ts.map +1 -0
  70. package/dist/plugins/utils/index.cjs +2 -0
  71. package/dist/plugins/utils/index.d.ts +1 -3
  72. package/dist/plugins/utils/index.d.ts.map +1 -1
  73. package/dist/plugins/utils/index.js +2 -2
  74. package/dist/shims-uni.d.ts +140 -0
  75. package/dist/type.d.ts +174 -16
  76. package/dist/type.d.ts.map +1 -1
  77. package/dist/utils/array.cjs +1 -0
  78. package/dist/utils/array.d.ts.map +1 -1
  79. package/dist/utils/array.js +1 -12
  80. package/dist/utils/date.cjs +1 -0
  81. package/dist/utils/date.d.ts.map +1 -1
  82. package/dist/utils/date.js +1 -59
  83. package/dist/utils/file.cjs +1 -0
  84. package/dist/utils/file.d.ts.map +1 -1
  85. package/dist/utils/file.js +1 -85
  86. package/dist/utils/function.cjs +1 -0
  87. package/dist/utils/function.d.ts +13 -0
  88. package/dist/utils/function.d.ts.map +1 -1
  89. package/dist/utils/function.js +1 -68
  90. package/dist/utils/index.cjs +1 -0
  91. package/dist/utils/index.d.ts.map +1 -1
  92. package/dist/utils/index.js +1 -63
  93. package/dist/utils/ip.cjs +1 -0
  94. package/dist/utils/ip.d.ts +1 -1
  95. package/dist/utils/ip.d.ts.map +1 -1
  96. package/dist/utils/ip.js +1 -45
  97. package/dist/utils/language.cjs +1 -0
  98. package/dist/utils/language.d.ts +2 -1
  99. package/dist/utils/language.d.ts.map +1 -1
  100. package/dist/utils/language.js +1 -63
  101. package/dist/utils/object.cjs +1 -0
  102. package/dist/utils/object.d.ts +4 -5
  103. package/dist/utils/object.d.ts.map +1 -1
  104. package/dist/utils/object.js +1 -136
  105. package/dist/utils/openLink.cjs +1 -0
  106. package/dist/utils/openLink.d.ts.map +1 -1
  107. package/dist/utils/openLink.js +1 -28
  108. package/dist/utils/page.cjs +1 -0
  109. package/dist/utils/page.d.ts.map +1 -1
  110. package/dist/utils/page.js +1 -7
  111. package/dist/utils/platform.cjs +1 -0
  112. package/dist/utils/platform.d.ts.map +1 -1
  113. package/dist/utils/platform.js +1 -17
  114. package/dist/utils/string.cjs +1 -0
  115. package/dist/utils/string.d.ts.map +1 -1
  116. package/dist/utils/string.js +1 -114
  117. package/dist/utils/utils.cjs +1 -0
  118. package/dist/utils/utils.d.ts +1 -1
  119. package/dist/utils/utils.d.ts.map +1 -1
  120. package/dist/utils/utils.js +1 -126
  121. package/dist/v3/AppTransition/index.vue +170 -0
  122. package/dist/v3/AutoSizer/index.vue +4 -5
  123. package/dist/v3/AutoSizer/index1.vue +4 -6
  124. package/dist/v3/AutoSizer/utils.ts +1 -1
  125. package/dist/v3/CaptureScreen/index.vue +19 -8
  126. package/dist/v3/CircularButton/index.vue +64 -13
  127. package/dist/v3/ConsoleList/ConsoleItem.vue +56 -5
  128. package/dist/v3/ConsoleList/RunJSInput.vue +10 -6
  129. package/dist/v3/ConsoleList/index.vue +51 -35
  130. package/dist/v3/CustomSwiper/CustomSwiperItem.vue +49 -0
  131. package/dist/v3/CustomSwiper/index.vue +104 -0
  132. package/dist/v3/DevTool/fps-collector.render.ts +148 -0
  133. package/dist/v3/DevTool/index.vue +209 -102
  134. package/dist/v3/DevToolButton/index.vue +40 -59
  135. package/dist/v3/DevToolTitle/index.vue +4 -1
  136. package/dist/v3/DevToolWindow/DevToolOverlay.vue +182 -0
  137. package/dist/v3/DevToolWindow/const.ts +47 -69
  138. package/dist/v3/DevToolWindow/hooks/dataUtils.ts +48 -0
  139. package/dist/v3/DevToolWindow/hooks/useDevToolData.ts +338 -0
  140. package/dist/v3/DevToolWindow/hooks/useDevToolHandlers.ts +549 -0
  141. package/dist/v3/DevToolWindow/hooks/useDevToolOverlay.ts +184 -0
  142. package/dist/v3/DevToolWindow/index.css +89 -0
  143. package/dist/v3/DevToolWindow/index.vue +800 -1450
  144. package/dist/v3/DraggableContainer/index.vue +456 -0
  145. package/dist/v3/ElEvent/ElEventItem.vue +4 -3
  146. package/dist/v3/ElEvent/index.vue +26 -9
  147. package/dist/v3/Empty/index.vue +1 -0
  148. package/dist/v3/FilterInput/index.vue +8 -22
  149. package/dist/v3/FilterSelect/index.vue +37 -24
  150. package/dist/v3/Instance/components/InstanceTreeNode.vue +265 -0
  151. package/dist/v3/Instance/flatten.ts +226 -0
  152. package/dist/v3/Instance/index.vue +94 -0
  153. package/dist/v3/Instance/registry.ts +49 -0
  154. package/dist/v3/Instance/transformTree.ts +375 -0
  155. package/dist/v3/Instance/transformTreeCtx.ts +268 -0
  156. package/dist/v3/{InstanceTree → Instance}/typing.d.ts +15 -2
  157. package/dist/v3/InstanceDetail/index.vue +433 -44
  158. package/dist/v3/JsonDetail/index.vue +12 -8
  159. package/dist/v3/JsonPretty/components/Brackets/index.vue +1 -0
  160. package/dist/v3/JsonPretty/components/Carets/index.vue +2 -1
  161. package/dist/v3/JsonPretty/components/CheckController/index.vue +26 -15
  162. package/dist/v3/JsonPretty/components/TreeNode/index.vue +42 -20
  163. package/dist/v3/JsonPretty/index.vue +60 -37
  164. package/dist/v3/JsonPretty/utils/index.ts +41 -44
  165. package/dist/v3/MovableContainer/index.vue +89 -0
  166. package/dist/v3/NFCList/NFCItem.vue +14 -14
  167. package/dist/v3/NFCList/NFCTool.vue +99 -81
  168. package/dist/v3/NFCList/index.vue +14 -10
  169. package/dist/v3/NetworkList/InterceptConfig.vue +154 -364
  170. package/dist/v3/NetworkList/InterceptItem.vue +14 -6
  171. package/dist/v3/NetworkList/NetworkDetail.vue +34 -29
  172. package/dist/v3/NetworkList/NetworkIntercept.vue +11 -8
  173. package/dist/v3/NetworkList/NetworkItem.vue +27 -11
  174. package/dist/v3/NetworkList/NetworkSend.vue +132 -290
  175. package/dist/v3/NetworkList/hooks/useNetworkForm.ts +86 -0
  176. package/dist/v3/NetworkList/index.vue +32 -24
  177. package/dist/v3/NetworkList/utils.ts +101 -0
  178. package/dist/v3/Performance/index.vue +495 -0
  179. package/dist/v3/Performance/modules/PerformanceMetrics.vue +153 -0
  180. package/dist/v3/Performance/modules/PerformanceWidget.vue +249 -0
  181. package/dist/v3/Performance/modules/usePerformanceChart.ts +460 -0
  182. package/dist/v3/Performance/modules/usePerformanceData.ts +258 -0
  183. package/dist/v3/Pick/index.vue +322 -0
  184. package/dist/v3/PiniaList/index.vue +38 -17
  185. package/dist/v3/RouteList/index.vue +32 -15
  186. package/dist/v3/RunJS/index.vue +30 -10
  187. package/dist/v3/ScanCodeList/ScanCodeItem.vue +2 -9
  188. package/dist/v3/ScanCodeList/index.vue +12 -9
  189. package/dist/v3/SettingButton/index.vue +45 -0
  190. package/dist/v3/SettingList/index.css +120 -0
  191. package/dist/v3/SettingList/index.vue +96 -537
  192. package/dist/v3/SettingList/modules/SettingDevTool.vue +208 -0
  193. package/dist/v3/SettingList/modules/SettingInfo.vue +119 -0
  194. package/dist/v3/SettingList/modules/SettingLanguage.vue +74 -0
  195. package/dist/v3/SettingList/modules/SettingLog.vue +230 -0
  196. package/dist/v3/SettingList/modules/SettingNetwork.vue +120 -0
  197. package/dist/v3/SettingList/modules/SettingTheme.vue +312 -0
  198. package/dist/v3/SourceCode/Line.vue +15 -2
  199. package/dist/v3/SourceCode/index.vue +25 -24
  200. package/dist/v3/SourceCode/parseCode.ts +114 -56
  201. package/dist/v3/StorageList/index.vue +33 -33
  202. package/dist/v3/Tabs/index.vue +31 -28
  203. package/dist/v3/Tag/index.vue +39 -20
  204. package/dist/v3/TransferList/TransferDetail.vue +268 -0
  205. package/dist/v3/TransferList/TransferItem.vue +125 -0
  206. package/dist/v3/TransferList/index.vue +181 -0
  207. package/dist/v3/UniEvent/UniEventItem.vue +1 -0
  208. package/dist/v3/UniEvent/index.vue +28 -29
  209. package/dist/v3/{VirtualListPro → VirtualList}/AutoSize.vue +1 -1
  210. package/dist/v3/VirtualList/index.vue +382 -82
  211. package/dist/v3/VuexList/index.vue +38 -17
  212. package/dist/v3/WebSocket/WebSocketDetail.vue +142 -80
  213. package/dist/v3/WebSocket/WebSocketItem.vue +10 -4
  214. package/dist/v3/WebSocket/index.vue +44 -30
  215. package/dist/v3/hooks/useNFC/index.ts +6 -6
  216. package/dist/v3/hooks/useNFC/typing.d.ts +2 -2
  217. package/dist/v3/hooks/useNFC/useNFCAndroid.ts +215 -626
  218. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +54 -85
  219. package/dist/v3/hooks/useNFC/utils.ts +3 -3
  220. package/dist/v3/hooks/useRequest/index.ts +2 -2
  221. package/dist/v3/hooks/useScanCode/index.ts +10 -8
  222. package/dist/v3/styles/theme.css +290 -0
  223. package/dist/v3/styles/theme.ts +12 -0
  224. package/package.json +25 -5
  225. package/dist/devConsole/index.d.ts.map +0 -1
  226. package/dist/devConsole/index.js +0 -273
  227. package/dist/devEvent/index.d.ts +0 -328
  228. package/dist/devEvent/index.d.ts.map +0 -1
  229. package/dist/devEvent/index.js +0 -697
  230. package/dist/devEventBus/index.d.ts +0 -42
  231. package/dist/devEventBus/index.d.ts.map +0 -1
  232. package/dist/devEventBus/index.js +0 -70
  233. package/dist/devIntercept/index.d.ts +0 -281
  234. package/dist/devIntercept/index.d.ts.map +0 -1
  235. package/dist/devIntercept/index.js +0 -949
  236. package/dist/devRunJS/index.d.ts +0 -67
  237. package/dist/devRunJS/index.d.ts.map +0 -1
  238. package/dist/devStore/index.d.ts +0 -199
  239. package/dist/devStore/index.d.ts.map +0 -1
  240. package/dist/devStore/index.js +0 -562
  241. package/dist/devToolInfo/index.d.ts +0 -17
  242. package/dist/devToolInfo/index.d.ts.map +0 -1
  243. package/dist/devToolInfo/index.js +0 -15
  244. package/dist/v3/AutoSizer/utils.d.ts +0 -5
  245. package/dist/v3/AutoSizer/utils.d.ts.map +0 -1
  246. package/dist/v3/ConsoleList/staticTips.d.ts +0 -13
  247. package/dist/v3/ConsoleList/staticTips.d.ts.map +0 -1
  248. package/dist/v3/DevToolWindow/const.d.ts +0 -46
  249. package/dist/v3/DevToolWindow/const.d.ts.map +0 -1
  250. package/dist/v3/InstanceTree/components/InstanceTreeNode.vue +0 -81
  251. package/dist/v3/InstanceTree/flatten.d.ts +0 -10
  252. package/dist/v3/InstanceTree/flatten.d.ts.map +0 -1
  253. package/dist/v3/InstanceTree/flatten.ts +0 -75
  254. package/dist/v3/InstanceTree/index.vue +0 -51
  255. package/dist/v3/InstanceTree/transformTree.d.ts +0 -17
  256. package/dist/v3/InstanceTree/transformTree.d.ts.map +0 -1
  257. package/dist/v3/InstanceTree/transformTree.ts +0 -237
  258. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +0 -4
  259. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +0 -1
  260. package/dist/v3/JsonPretty/hooks/useError.d.ts +0 -8
  261. package/dist/v3/JsonPretty/hooks/useError.d.ts.map +0 -1
  262. package/dist/v3/JsonPretty/type.d.ts +0 -94
  263. package/dist/v3/JsonPretty/type.d.ts.map +0 -1
  264. package/dist/v3/JsonPretty/utils/index.d.ts +0 -10
  265. package/dist/v3/JsonPretty/utils/index.d.ts.map +0 -1
  266. package/dist/v3/NFCList/const.d.ts +0 -13
  267. package/dist/v3/NFCList/const.d.ts.map +0 -1
  268. package/dist/v3/NetworkList/const.d.ts +0 -5
  269. package/dist/v3/NetworkList/const.d.ts.map +0 -1
  270. package/dist/v3/SourceCode/parseCode.d.ts +0 -27
  271. package/dist/v3/SourceCode/parseCode.d.ts.map +0 -1
  272. package/dist/v3/UploadList/UploadDetail.vue +0 -255
  273. package/dist/v3/UploadList/UploadItem.vue +0 -122
  274. package/dist/v3/UploadList/index.vue +0 -125
  275. package/dist/v3/VirtualListPro/index.vue +0 -229
  276. package/dist/v3/hooks/useContainerStyle.d.ts +0 -15
  277. package/dist/v3/hooks/useContainerStyle.d.ts.map +0 -1
  278. package/dist/v3/hooks/useNFC/index.d.ts +0 -5
  279. package/dist/v3/hooks/useNFC/index.d.ts.map +0 -1
  280. package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts +0 -2
  281. package/dist/v3/hooks/useNFC/useNFCAndroid.d.ts.map +0 -1
  282. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts +0 -2
  283. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.d.ts.map +0 -1
  284. package/dist/v3/hooks/useNFC/utils.d.ts +0 -95
  285. package/dist/v3/hooks/useNFC/utils.d.ts.map +0 -1
  286. package/dist/v3/hooks/useRequest/index.d.ts +0 -126
  287. package/dist/v3/hooks/useRequest/index.d.ts.map +0 -1
  288. package/dist/v3/hooks/useRequest/utils.d.ts +0 -35
  289. package/dist/v3/hooks/useRequest/utils.d.ts.map +0 -1
  290. package/dist/v3/hooks/useScanCode/index.d.ts +0 -36
  291. package/dist/v3/hooks/useScanCode/index.d.ts.map +0 -1
  292. /package/dist/v3/{VirtualListPro → VirtualList}/readme.md +0 -0
@@ -1,18 +1,22 @@
1
1
  <template>
2
2
  <view class="nfc-item">
3
3
  <view @click.stop="onOpenJson">
4
- <view class="nfc-item-row"> 标签ID: {{ nfcItem?.hexString }} </view>
4
+ <view class="nfc-item-row">
5
+ {{ t('nfc.tagId') }}: {{ nfcItem?.hexString }}
6
+ </view>
5
7
 
6
8
  <view class="nfc-item-row">
7
- 标签类型: {{ nfcItem?.techs?.join(',') }}
9
+ {{ t('nfc.tagType') }}: {{ nfcItem?.techs?.join(',') }}
8
10
  </view>
9
11
 
10
12
  <view class="nfc-item-row">
11
- 技术标准:{{ nfcItem?.readWriteStandard?.join(',') }}
13
+ {{ t('nfc.standard') }}:{{ nfcItem?.readWriteStandard?.join(',') }}
12
14
  </view>
13
15
 
14
16
  <view class="nfc-item-row">
15
- 最大传输长度:{{ nfcItem?.maxTransceiveLength ?? 0 }}字节
17
+ {{ t('nfc.maxTransceiveLength') }}:{{
18
+ nfcItem?.maxTransceiveLength ?? 0
19
+ }}{{ t('nfc.unitByte') }}
16
20
  </view>
17
21
  </view>
18
22
  <!-- <view class="nfc-item-row"> {{ scanCodeItem.eventName }} </view> -->
@@ -37,6 +41,9 @@
37
41
  import { computed } from 'vue';
38
42
  import type { DevTool } from '../../type';
39
43
  import { formatDate, isMockWX } from '../../utils';
44
+ import { useI18n } from '../../i18n';
45
+
46
+ const { t } = useI18n();
40
47
 
41
48
  const props = defineProps<{
42
49
  nfcItem: DevTool.NFCItem;
@@ -59,7 +66,7 @@ const isUseDevSource = computed(() => {
59
66
 
60
67
  function onOpenJson() {
61
68
  emit('openJson', {
62
- title: 'NFC 详情',
69
+ title: t('nfc.detail'),
63
70
  data: props.nfcItem,
64
71
  });
65
72
  }
@@ -84,6 +91,7 @@ function onOpenJson() {
84
91
  text-align: right;
85
92
  word-break: break-all;
86
93
  }
94
+
87
95
  .link {
88
96
  cursor: pointer;
89
97
  text-decoration: underline;
@@ -98,16 +106,8 @@ function onOpenJson() {
98
106
  align-items: center;
99
107
  min-height: 24px;
100
108
  }
109
+
101
110
  .nfc-item-position > view {
102
111
  width: 25%;
103
112
  }
104
-
105
- .nfc-item-right {
106
- text-align: right;
107
- word-break: break-all;
108
- }
109
- .link {
110
- cursor: pointer;
111
- text-decoration: underline;
112
- }
113
113
  </style>
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <view class="nfc-tool" :style="customStyle">
3
3
  <view class="nfc-tool-control">
4
- <DevToolTitle>NFC 工具</DevToolTitle>
4
+ <DevToolTitle>{{ t('nfc.toolTitle') }}</DevToolTitle>
5
5
 
6
6
  <Tag
7
7
  mode="info"
8
- v-for="item in selectItems"
8
+ v-for="item in translatedSelectItems"
9
9
  :active="item.value === currentSelect"
10
10
  :key="item.value"
11
11
  customStyle="margin-left: 16px"
@@ -23,32 +23,36 @@
23
23
  <scroll-view scroll-y style="height: calc(100% - 32px)">
24
24
  <view class="nfc-tool-base">
25
25
  <view class="nfc-tool-tips">
26
- tips: 工具仅用于开发测试,如做其他用途,后果自负
26
+ {{ t('nfc.tipsTool') }}
27
27
  </view>
28
- <DevToolTitle>状态</DevToolTitle>
28
+ <DevToolTitle>{{ t('nfc.status') }}</DevToolTitle>
29
29
  <view class="nfc-tool-status">
30
- <view class="nfc-tool-status-key">设备是否支持NFC:</view>
31
- <Tag mode="success" v-if="isSupportNFC">支持</Tag>
32
- <Tag mode="error" v-else>不支持</Tag>
30
+ <view class="nfc-tool-status-key">{{ t('nfc.deviceSupport') }}</view>
31
+ <Tag mode="success" v-if="isSupportNFC">{{ t('nfc.support') }}</Tag>
32
+ <Tag mode="error" v-else>{{ t('nfc.notSupport') }}</Tag>
33
33
  </view>
34
34
  <view class="nfc-tool-status">
35
- <view class="nfc-tool-status-key">NFC启用状态:</view>
36
- <Tag mode="success" v-if="isListening">启用</Tag>
37
- <Tag mode="error" v-else>关闭</Tag>
35
+ <view class="nfc-tool-status-key">{{ t('nfc.enabledStatus') }}</view>
36
+ <Tag mode="success" v-if="isListening">{{ t('nfc.enabled') }}</Tag>
37
+ <Tag mode="error" v-else>{{ t('nfc.disabled') }}</Tag>
38
38
  </view>
39
39
  <view class="nfc-tool-status">
40
- <view class="nfc-tool-status-key">NFC连接状态:</view>
41
- <Tag mode="success" v-if="isConnected">连接</Tag>
42
- <Tag mode="error" v-else>断开</Tag>
40
+ <view class="nfc-tool-status-key">{{ t('nfc.connectStatus') }}</view>
41
+ <Tag mode="success" v-if="isConnected">{{ t('nfc.connected') }}</Tag>
42
+ <Tag mode="error" v-else>{{ t('nfc.disconnected') }}</Tag>
43
43
  </view>
44
44
 
45
- <DevToolTitle>NFC 操作</DevToolTitle>
46
- <button class="nfc-tool-button" @click="startHCE">启用NFC扫描</button>
47
- <button class="nfc-tool-button" @click="stopHCE">关闭NFC扫描</button>
45
+ <DevToolTitle>{{ t('nfc.operation') }}</DevToolTitle>
46
+ <SettingButton class="nfc-tool-button" @click="startHCE">
47
+ {{ t('nfc.startScan') }}
48
+ </SettingButton>
49
+ <SettingButton class="nfc-tool-button" @click="stopHCE">
50
+ {{ t('nfc.stopScan') }}
51
+ </SettingButton>
48
52
  </view>
49
53
 
50
54
  <view class="nfc-tool-read" v-if="currentSelect === 'read'">
51
- <DevToolTitle>结果</DevToolTitle>
55
+ <DevToolTitle>{{ t('nfc.result') }}</DevToolTitle>
52
56
  <JsonPretty
53
57
  virtual
54
58
  v-if="showJson"
@@ -58,17 +62,17 @@
58
62
  :pathCollapsible="() => false"
59
63
  :height="contentHeight - 32 * 5 - 28 * 3 - 16 - 20"
60
64
  />
61
- <Empty v-else text="暂无结果" />
65
+ <Empty v-else :text="t('nfc.noResult')" />
62
66
  </view>
63
67
  <view class="nfc-tool-write" v-if="currentSelect === 'write'">
64
- <DevToolTitle>NFC 写入</DevToolTitle>
68
+ <DevToolTitle>{{ t('nfc.write') }}</DevToolTitle>
65
69
  <radio-group
66
70
  class="radio-group"
67
71
  @change="onChangeFormData('writeMethod', $event)"
68
72
  >
69
73
  <label
70
74
  class="radio-group-item"
71
- v-for="item in writeMethods"
75
+ v-for="item in translatedWriteMethods"
72
76
  :key="item.value"
73
77
  >
74
78
  <radio
@@ -87,20 +91,20 @@
87
91
  class="nfc-tool-write-form"
88
92
  v-if="formData.writeMethod === 'text'"
89
93
  >
90
- <DevToolTitle>文本内容</DevToolTitle>
94
+ <DevToolTitle>{{ t('nfc.textContent') }}</DevToolTitle>
91
95
  <textarea
92
96
  class="textarea"
93
97
  :value="formData.text"
94
- placeholder="请输入要写入的文本"
98
+ :placeholder="t('nfc.placeholderText')"
95
99
  @input="onChangeFormData('text', $event)"
96
100
  />
97
101
  </view>
98
102
 
99
103
  <view class="nfc-tool-write-form" v-if="formData.writeMethod === 'uri'">
100
- <DevToolTitle>网址链接</DevToolTitle>
104
+ <DevToolTitle>{{ t('nfc.link') }}</DevToolTitle>
101
105
  <textarea
102
106
  class="textarea"
103
- placeholder="请输入要写入的网址, 例如:https://gitee.com/cloud_l/vite-uni-dev-tool"
107
+ :placeholder="t('nfc.placeholderLink')"
104
108
  :value="formData.uri"
105
109
  @input="onChangeFormData('uri', $event)"
106
110
  />
@@ -110,28 +114,28 @@
110
114
  class="nfc-tool-write-form"
111
115
  v-if="formData.writeMethod === 'wifi'"
112
116
  >
113
- <DevToolTitle>WIFI配置</DevToolTitle>
117
+ <DevToolTitle>{{ t('nfc.wifiConfig') }}</DevToolTitle>
114
118
  <input
115
119
  class="input"
116
- placeholder="WIFI名称(SSID)"
120
+ :placeholder="t('nfc.placeholderSsid')"
117
121
  :value="formData.ssid"
118
122
  @input="onChangeFormData('ssid', $event)"
119
123
  />
120
124
  <input
121
125
  class="input"
122
- placeholder="WIFI密码"
126
+ :placeholder="t('nfc.placeholderPassword')"
123
127
  type="password"
124
128
  :value="formData.password"
125
129
  @input="onChangeFormData('password', $event)"
126
130
  />
127
- <view class="sub-title">加密方式:</view>
131
+ <view class="sub-title">{{ t('nfc.encryption') }}</view>
128
132
  <radio-group
129
133
  class="radio-group"
130
134
  @change="onChangeFormData('authType', $event)"
131
135
  >
132
136
  <label
133
137
  class="radio-group-item"
134
- v-for="item in encryptionMethods"
138
+ v-for="item in translatedEncryptionMethods"
135
139
  :key="item.value"
136
140
  >
137
141
  <radio
@@ -150,43 +154,43 @@
150
154
  class="nfc-tool-write-form"
151
155
  v-if="formData.writeMethod === 'card'"
152
156
  >
153
- <DevToolTitle>名片信息</DevToolTitle>
157
+ <DevToolTitle>{{ t('nfc.cardInfo') }}</DevToolTitle>
154
158
  <input
155
159
  class="input"
156
- placeholder="姓名"
160
+ :placeholder="t('nfc.placeholderName')"
157
161
  :value="formData.name"
158
162
  @input="onChangeFormData('name', $event)"
159
163
  />
160
164
  <input
161
165
  class="input"
162
- placeholder="公司"
166
+ :placeholder="t('nfc.placeholderOrg')"
163
167
  :value="formData.organization"
164
168
  @input="onChangeFormData('organization', $event)"
165
169
  />
166
170
  <input
167
171
  class="input"
168
- placeholder="电话"
172
+ :placeholder="t('nfc.placeholderTel')"
169
173
  :value="formData.tel"
170
174
  @input="onChangeFormData('tel', $event)"
171
175
  />
172
176
  <input
173
177
  class="input"
174
- placeholder="地址"
178
+ :placeholder="t('nfc.placeholderAddress')"
175
179
  :value="formData.address"
176
180
  @input="onChangeFormData('address', $event)"
177
181
  />
178
182
  <input
179
183
  class="input"
180
- placeholder="网址"
184
+ :placeholder="t('nfc.placeholderWeb')"
181
185
  :value="formData.uri"
182
186
  @input="onChangeFormData('uri', $event)"
183
187
  />
184
188
  </view>
185
189
  <view class="nfc-tool-write-form" v-if="formData.writeMethod === 'tel'">
186
- <DevToolTitle>电话</DevToolTitle>
190
+ <DevToolTitle>{{ t('nfc.tel') }}</DevToolTitle>
187
191
  <input
188
192
  class="input"
189
- placeholder="电话: 例如 188888888888"
193
+ :placeholder="t('nfc.placeholderTelInput')"
190
194
  :value="formData.tel"
191
195
  @input="onChangeFormData('tel', $event)"
192
196
  />
@@ -195,31 +199,31 @@
195
199
  class="nfc-tool-write-form"
196
200
  v-if="formData.writeMethod === 'packageName'"
197
201
  >
198
- <DevToolTitle>APP启动</DevToolTitle>
202
+ <DevToolTitle>{{ t('nfc.appLaunch') }}</DevToolTitle>
199
203
  <input
200
204
  class="input"
201
- placeholder="APP包名 例如: com.example.app"
205
+ :placeholder="t('nfc.placeholderPkg')"
202
206
  :value="formData.packageName"
203
207
  @input="onChangeFormData('packageName', $event)"
204
208
  />
205
209
  </view>
206
- <button class="nfc-tool-button" @click="onWrite">开始写入</button>
210
+ <SettingButton @click="onWrite">{{
211
+ t('nfc.startWrite')
212
+ }}</SettingButton>
207
213
  <view class="nfc-tool-tips">
208
- tips: 写入过程中请勿移动,防止写入失败
214
+ {{ t('nfc.tipsWriting') }}
209
215
  </view>
210
216
  </view>
211
217
  <view class="nfc-tool-copy" v-if="currentSelect === 'copy'">
212
- <DevToolTitle>NFC 复制</DevToolTitle>
213
- <DevToolTitle>第一步:启用NFC扫描读取源标签</DevToolTitle>
214
- <DevToolTitle>
215
- 第二步:更换为目标标签,将源标签复制到目标标签
216
- </DevToolTitle>
217
- <button class="nfc-tool-button" @click="onCopy">复制</button>
218
+ <DevToolTitle>{{ t('nfc.copy') }}</DevToolTitle>
219
+ <DevToolTitle>{{ t('nfc.step1') }}</DevToolTitle>
220
+ <DevToolTitle>{{ t('nfc.step2') }}</DevToolTitle>
221
+ <SettingButton @click="onCopy">{{ t('nfc.toCopy') }}</SettingButton>
218
222
  <view class="nfc-tool-tips">
219
- tips: 复制过程中请勿移动,防止写入失败
223
+ {{ t('nfc.tipsCopying') }}
220
224
  </view>
221
- <DevToolTitle>第三步:写入完成之后关闭NFC扫描</DevToolTitle>
222
- <button class="nfc-tool-button" @click="stopHCE">关闭NFC扫描</button>
225
+ <DevToolTitle>{{ t('nfc.step3') }}</DevToolTitle>
226
+ <SettingButton @click="stopHCE">{{ t('nfc.stopScan') }}</SettingButton>
223
227
  </view>
224
228
  </scroll-view>
225
229
  </view>
@@ -232,8 +236,36 @@ import DevToolTitle from '../DevToolTitle/index.vue';
232
236
  import JsonPretty from '../JsonPretty/index.vue';
233
237
  import Empty from '../Empty/index.vue';
234
238
  import useNFC from '../hooks/useNFC';
239
+ import SettingButton from '../SettingButton/index.vue';
235
240
  import { selectItems, writeMethods, encryptionMethods } from './const';
236
- const props = defineProps<{
241
+ import { useI18n } from '../../i18n';
242
+
243
+ const { t } = useI18n();
244
+
245
+ const translatedSelectItems = computed(() => {
246
+ return selectItems.map((item) => ({
247
+ ...item,
248
+ label: item.value === 'read' ? t('nfc.read') : t('nfc.writeLabel'),
249
+ }));
250
+ });
251
+
252
+ const translatedWriteMethods = computed(() => {
253
+ return writeMethods.map((item) => ({
254
+ ...item,
255
+ label: t(`nfc.writeMethods.${item.value}`),
256
+ }));
257
+ });
258
+
259
+ const translatedEncryptionMethods = computed(() => {
260
+ return encryptionMethods.map((item) => ({
261
+ ...item,
262
+ label:
263
+ t(`nfc.authTypes.${item.value}`) !== `nfc.authTypes.${item.value}`
264
+ ? t(`nfc.authTypes.${item.value}`)
265
+ : item.label,
266
+ }));
267
+ });
268
+ const _props = defineProps<{
237
269
  contentHeight: number;
238
270
  customStyle?: Record<string, any>;
239
271
  }>();
@@ -270,7 +302,7 @@ const {
270
302
  isListening,
271
303
  startHCE,
272
304
  stopHCE,
273
- writeNdfText,
305
+ writeNdefText,
274
306
  writeNdefUri,
275
307
  writeNdefAndroidApp,
276
308
  writeNdefWifi,
@@ -293,7 +325,7 @@ function onChangeFormData(key: keyof typeof formData, e: any) {
293
325
  function onWrite() {
294
326
  switch (formData.writeMethod) {
295
327
  case 'text':
296
- writeNdfText(formData.text);
328
+ writeNdefText(formData.text);
297
329
  break;
298
330
  case 'uri':
299
331
  writeNdefUri(formData.uri);
@@ -314,15 +346,14 @@ function onWrite() {
314
346
  case 'card':
315
347
  if (!formData.name) {
316
348
  uni.showToast({
317
- title: '请填写姓名',
349
+ title: t('nfc.toast.enterName'),
318
350
  icon: 'none',
319
351
  });
320
-
321
352
  return;
322
353
  }
323
354
  if (!formData.tel) {
324
355
  uni.showToast({
325
- title: '请填写电话',
356
+ title: t('nfc.toast.enterTel'),
326
357
  icon: 'none',
327
358
  });
328
359
  return;
@@ -335,6 +366,7 @@ function onWrite() {
335
366
  version: 'V3.0',
336
367
  organization: formData.organization,
337
368
  });
369
+ break;
338
370
  default:
339
371
  break;
340
372
  }
@@ -345,7 +377,7 @@ function onCopy() {
345
377
  // 复制到目标标签
346
378
  // 断开连接
347
379
  uni.showToast({
348
- title: 'NFC 卡购买中...',
380
+ title: t('nfc.copying'),
349
381
  icon: 'none',
350
382
  });
351
383
  }
@@ -355,38 +387,41 @@ function onCopy() {
355
387
  position: fixed;
356
388
  width: 100vw;
357
389
  height: 100%;
358
-
359
390
  top: 0;
360
391
  left: 0;
361
-
362
392
  background-color: var(--dev-tool-bg3-color);
363
393
  box-sizing: border-box;
364
394
  }
395
+
365
396
  .nfc-tool-control {
366
397
  padding: 0 16px;
367
398
  display: flex;
368
399
  align-items: center;
400
+
369
401
  /* gap: 12px; */
370
402
  height: 32px;
371
403
  border-bottom: 1px solid var(--dev-tool-border-color);
372
404
  box-sizing: border-box;
373
405
  }
406
+
374
407
  .nfc-tool-tips {
375
- font-size: 10px;
408
+ font-size: var(--dev-tool-tips-font-size);
376
409
  line-height: 20px;
377
410
  color: #616161;
378
411
  }
412
+
379
413
  .nfc-tool-base {
380
414
  padding: 0 16px;
381
415
  }
416
+
382
417
  .nfc-tool-status {
383
418
  display: flex;
384
419
  align-items: center;
385
420
  justify-content: space-between;
386
421
  min-height: 28px;
387
422
  word-break: break-all;
388
- font-size: 12px;
389
423
  }
424
+
390
425
  .nfc-tool-status-key {
391
426
  white-space: nowrap;
392
427
  margin-right: 8px;
@@ -398,22 +433,7 @@ function onCopy() {
398
433
  .nfc-tool-copy {
399
434
  padding: 0 16px;
400
435
  }
401
- .nfc-tool-button {
402
- display: flex;
403
- align-items: center;
404
- justify-content: center;
405
- width: 100%;
406
- height: 32px;
407
- border-radius: 4px;
408
- color: #fff;
409
- outline: none;
410
- border: 1px solid transparent;
411
- background-color: var(--dev-tool-main-color);
412
- transform: all 0.3s;
413
- font-size: var(--dev-tool-base-font-size);
414
- padding: 0;
415
- cursor: pointer;
416
- }
436
+
417
437
  .nfc-tool-button + .nfc-tool-button {
418
438
  margin-top: 8px;
419
439
  }
@@ -422,35 +442,33 @@ function onCopy() {
422
442
  display: flex;
423
443
  flex-wrap: wrap;
424
444
  }
445
+
425
446
  .radio-group-item {
426
447
  display: flex;
427
448
  align-items: center;
428
449
  justify-content: center;
429
450
  width: 33.33%;
430
451
  margin-bottom: 6px;
431
- font-size: 12px;
432
452
  }
433
453
 
434
454
  .textarea {
435
455
  padding: 6px;
436
456
  width: 100%;
437
457
  box-sizing: border-box;
438
- font-size: 12px;
439
458
  border: 1px solid var(--dev-tool-border-color);
440
459
  }
441
460
 
442
461
  .input {
443
462
  padding: 0 6px;
444
463
  height: 24px;
445
- font-size: 12px;
446
464
  border: 1px solid var(--dev-tool-border-color);
447
465
  }
466
+
448
467
  .input + .input {
449
468
  margin-top: 8px;
450
469
  }
451
470
 
452
471
  .sub-title {
453
- font-size: 12px;
454
472
  line-height: 20px;
455
473
  }
456
474
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view class="nfc-content">
3
3
  <view class="nfc-control">
4
- <DevToolTitle> NFC 列表 </DevToolTitle>
4
+ <DevToolTitle> {{ t('nfc.title') }} </DevToolTitle>
5
5
 
6
6
  <Tag
7
7
  mode="clear"
@@ -9,12 +9,12 @@
9
9
  customStyle="margin:0 16px 0 auto"
10
10
  @click="emit('openTool')"
11
11
  >
12
- 工具
12
+ {{ t('common.tool') }}
13
13
  </Tag>
14
- <Tag mode="clear" @click="emit('clear')"> 清空 </Tag>
14
+ <Tag mode="clear" @click="emit('clear')"> {{ t('common.clear') }} </Tag>
15
15
  </view>
16
16
 
17
- <VirtualListPro
17
+ <VirtualList
18
18
  v-if="nfcList && nfcList?.length > 0"
19
19
  class="nfc-list"
20
20
  :pageSize="20"
@@ -40,7 +40,7 @@
40
40
  />
41
41
  </AutoSize>
42
42
  </template>
43
- </VirtualListPro>
43
+ </VirtualList>
44
44
 
45
45
  <Empty v-else />
46
46
  </view>
@@ -50,11 +50,14 @@ import DevToolTitle from '../DevToolTitle/index.vue';
50
50
  import NFCItem from './NFCItem.vue';
51
51
  import Tag from '../Tag/index.vue';
52
52
  import Empty from '../Empty/index.vue';
53
- import VirtualListPro from '../VirtualListPro/index.vue';
54
- import AutoSize from '../VirtualListPro/AutoSize.vue';
53
+ import VirtualList from '../VirtualList/index.vue';
54
+ import AutoSize from '../VirtualList/AutoSize.vue';
55
55
  import type { DevTool } from '../../type';
56
+ import { useI18n } from '../../i18n';
56
57
 
57
- const props = defineProps<{
58
+ const { t } = useI18n();
59
+
60
+ const _props = defineProps<{
58
61
  nfcList?: DevTool.NFCItem[];
59
62
  zIndex?: number;
60
63
  contentHeight: number;
@@ -65,8 +68,8 @@ const props = defineProps<{
65
68
  const emit = defineEmits<{
66
69
  (e: 'clear'): void;
67
70
  (e: 'openTool'): void;
68
- (e: 'openJson', value?: DevTool.Arg): void;
69
- (e: 'openCode', value: { title?: string; data: Record<string, any> }): void;
71
+ (e: 'openJson', value?: { title?: string; data: Record<string, any> }): void;
72
+ (e: 'openCode', value?: string): void;
70
73
  }>();
71
74
  </script>
72
75
  <style scoped>
@@ -80,6 +83,7 @@ const emit = defineEmits<{
80
83
  display: flex;
81
84
  align-items: center;
82
85
  justify-content: space-between;
86
+
83
87
  /* gap: 8px; */
84
88
  padding: 0 16px;
85
89
  height: 32px;