hy-app 0.2.18 → 0.3.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.
@@ -21,52 +21,52 @@
21
21
  </template>
22
22
 
23
23
  <script setup lang="ts">
24
- import { ref, reactive, onMounted, computed } from "vue";
25
- import { onHide } from "@dcloudio/uni-app";
26
- import { storeToRefs } from "pinia";
27
- import { useUserInfo } from "../../store";
28
- import { decryptData, encryptData } from "../../utils";
29
- import { FormTypeEnum } from "../../typing";
30
- import { IconConfig } from "../../config";
31
- import type { UserLoginInfoVo } from "./typing";
24
+ import { ref, reactive, onMounted, computed } from 'vue'
25
+ import { onHide } from '@dcloudio/uni-app'
26
+ import { storeToRefs } from 'pinia'
27
+ import { useUserInfo } from '../../store'
28
+ import { decryptData, encryptData } from '../../utils'
29
+ import { FormTypeEnum } from '../../typing'
30
+ import { IconConfig } from '../../config'
31
+ import type { UserLoginInfoVo } from './typing'
32
32
 
33
33
  // 组件
34
- import HyCheckbox from "../hy-checkbox/hy-checkbox.vue";
35
- import HyForm from "../hy-form/hy-form.vue";
34
+ import HyCheckbox from '../hy-checkbox/hy-checkbox.vue'
35
+ import HyForm from '@/package/components/hy-form-group/hy-form.vue'
36
36
 
37
37
  interface IProps {
38
- themeColor: string;
39
- prefix: string;
40
- isShowPwd: boolean;
41
- userPlaceholder: string;
42
- pwdPlaceholder: string;
43
- customUserValidator: Record<string, any>;
44
- customPwdValidator: Record<string, any>;
45
- userNumValidator: Record<string, any>;
46
- pwdNumValidator: Record<string, any>;
38
+ themeColor: string
39
+ prefix: string
40
+ isShowPwd: boolean
41
+ userPlaceholder: string
42
+ pwdPlaceholder: string
43
+ customUserValidator: Record<string, any>
44
+ customPwdValidator: Record<string, any>
45
+ userNumValidator: Record<string, any>
46
+ pwdNumValidator: Record<string, any>
47
47
  }
48
48
 
49
49
  const props = withDefaults(defineProps<IProps>(), {
50
- themeColor: "",
51
- prefix: "hy",
50
+ themeColor: '',
51
+ prefix: 'hy',
52
52
  isShowPwd: false,
53
- userPlaceholder: "",
54
- pwdPlaceholder: "",
53
+ userPlaceholder: '',
54
+ pwdPlaceholder: '',
55
55
  customUserValidator: () => ({}),
56
56
  customPwdValidator: () => ({}),
57
57
  userNumValidator: () => ({}),
58
58
  pwdNumValidator: () => ({}),
59
- });
60
- const emit = defineEmits(["handleHistory", "handleCheckbox"]);
61
- const userInfoStore = useUserInfo();
62
- const { userForm, choiceList, rememberPsw } = storeToRefs(userInfoStore);
59
+ })
60
+ const emit = defineEmits(['handleHistory', 'handleCheckbox'])
61
+ const userInfoStore = useUserInfo()
62
+ const { userForm, choiceList, rememberPsw } = storeToRefs(userInfoStore)
63
63
 
64
- const showChoice = ref<boolean>(false);
65
- const showPwd = ref<boolean>(false);
64
+ const showChoice = ref<boolean>(false)
65
+ const showPwd = ref<boolean>(false)
66
66
  const userColumns = computed(() => [
67
67
  {
68
- field: "userName",
69
- label: "",
68
+ field: 'userName',
69
+ label: '',
70
70
  type: FormTypeEnum.TEXT,
71
71
  input: {
72
72
  clearable: true,
@@ -76,20 +76,18 @@ const userColumns = computed(() => [
76
76
  color: props.themeColor,
77
77
  },
78
78
  suffixIcon: {
79
- name: showChoice.value
80
- ? IconConfig.ARROW_UP_FILL
81
- : IconConfig.ARROW_DOWN_FILL,
79
+ name: showChoice.value ? IconConfig.ARROW_UP_FILL : IconConfig.ARROW_DOWN_FILL,
82
80
  color: props.themeColor,
83
81
  },
84
82
  onSuffix: () => {
85
- showChoice.value = !showChoice.value;
83
+ showChoice.value = !showChoice.value
86
84
  },
87
85
  },
88
86
  rules: [props.customUserValidator, props.userNumValidator],
89
87
  },
90
88
  {
91
- field: "password",
92
- label: "",
89
+ field: 'password',
90
+ label: '',
93
91
  type: showPwd.value ? FormTypeEnum.TEXT : FormTypeEnum.PASSWORD,
94
92
  input: {
95
93
  clearable: true,
@@ -103,22 +101,22 @@ const userColumns = computed(() => [
103
101
  color: props.themeColor,
104
102
  },
105
103
  onSuffix: () => {
106
- showPwd.value = !showPwd.value;
104
+ showPwd.value = !showPwd.value
107
105
  },
108
106
  },
109
107
  rules: [props.customUserValidator, props.pwdNumValidator],
110
108
  },
111
- ]);
112
- const rememberList = reactive([{ label: "记住密码", value: 1 }]);
113
- const form_1Ref = ref<InstanceType<typeof HyForm>>();
109
+ ])
110
+ const rememberList = reactive([{ label: '记住密码', value: 1 }])
111
+ const form_1Ref = ref<InstanceType<typeof HyForm>>()
114
112
  // 效验用户名和密码
115
113
  const userRules = reactive({
116
114
  userName: [
117
115
  {
118
116
  required: true,
119
- message: "请先输入账号",
117
+ message: '请先输入账号',
120
118
  // 可以单个或者同时写两个触发验证方式
121
- trigger: ["blur", "change"],
119
+ trigger: ['blur', 'change'],
122
120
  },
123
121
  props.customUserValidator,
124
122
  props.userNumValidator,
@@ -126,44 +124,44 @@ const userRules = reactive({
126
124
  password: [
127
125
  {
128
126
  required: true,
129
- message: "请输入密码",
127
+ message: '请输入密码',
130
128
  // 可以单个或者同时写两个触发验证方式
131
- trigger: ["blur", "change"],
129
+ trigger: ['blur', 'change'],
132
130
  },
133
131
  props.pwdNumValidator,
134
132
  props.customPwdValidator,
135
133
  ],
136
- });
137
- const rememberPassword = ref(false);
138
- const account = uni.getStorageSync(`${props.prefix}_account`);
139
- const accountList = uni.getStorageSync(`${props.prefix}_choiceList`);
134
+ })
135
+ const rememberPassword = ref(false)
136
+ const account = uni.getStorageSync(`${props.prefix}_account`)
137
+ const accountList = uni.getStorageSync(`${props.prefix}_choiceList`)
140
138
 
141
139
  onMounted(() => {
142
- if (!account) return;
143
- const result = decryptData(account);
144
- console.log(result);
140
+ if (!account) return
141
+ const result = decryptData(account)
142
+ console.log(result)
145
143
  //有缓存就赋值给文本没有就清空
146
- rememberPsw.value = result?.rememberPsw;
144
+ rememberPsw.value = result?.rememberPsw
147
145
  //获取缓存的账号和密码
148
- userForm.value.userName = result?.userName;
149
- userForm.value.password = result?.password;
146
+ userForm.value.userName = result?.userName
147
+ userForm.value.password = result?.password
150
148
 
151
149
  if (accountList) {
152
- choiceList.value = decryptData(accountList) as UserLoginInfoVo[];
150
+ choiceList.value = decryptData(accountList) as UserLoginInfoVo[]
153
151
  }
154
- });
152
+ })
155
153
 
156
154
  onHide(() => {
157
155
  // if (!account) return;
158
156
  //获取缓存的账号和密码
159
- const { userName, password } = decryptData(account);
157
+ const { userName, password } = decryptData(account)
160
158
  if (choiceList.value.length) {
161
159
  // 过滤数判断是否有一样的账号
162
160
  const filterArr = choiceList.value.filter((item) => {
163
- return item.user === userName;
164
- });
161
+ return item.user === userName
162
+ })
165
163
  // 有一样的账号退出函数不执行下面的
166
- if (filterArr.length) return;
164
+ if (filterArr.length) return
167
165
  }
168
166
  // 判断是否有保存账号和密码
169
167
  if (userName && password) {
@@ -171,17 +169,14 @@ onHide(() => {
171
169
  choiceList.value.unshift({
172
170
  user: userName,
173
171
  pwd: password,
174
- });
172
+ })
175
173
  // 数组最多只放三个账号
176
174
  if (choiceList.value.length >= 5) {
177
- choiceList.value.splice(5, 1);
175
+ choiceList.value.splice(5, 1)
178
176
  }
179
- uni.setStorageSync(
180
- `${props.prefix}_choiceList`,
181
- encryptData(choiceList.value),
182
- );
177
+ uni.setStorageSync(`${props.prefix}_choiceList`, encryptData(choiceList.value))
183
178
  }
184
- });
179
+ })
185
180
 
186
181
  /**
187
182
  * 登录效验
@@ -191,30 +186,30 @@ const loginFn = () => {
191
186
  form_1Ref.value
192
187
  ?.handleSubmit()
193
188
  .then((res) => {
194
- resolve("success" + res);
189
+ resolve('success' + res)
195
190
  })
196
191
  .catch((err) => {
197
- reject("error" + err);
198
- });
199
- });
200
- };
192
+ reject('error' + err)
193
+ })
194
+ })
195
+ }
201
196
 
202
197
  /**
203
198
  * 勾选是否记住密码
204
199
  * */
205
200
  const checkboxChange = () => {
206
- emit("handleCheckbox", rememberPassword.value);
207
- };
201
+ emit('handleCheckbox', rememberPassword.value)
202
+ }
208
203
 
209
204
  /**
210
205
  * 选择历史账号
211
206
  * */
212
207
  const btnChoiceClick = (index: number) => {
213
- showChoice.value = false;
214
- userForm.value.name = choiceList.value[index].user;
215
- userForm.value.pwd = choiceList.value[index].pwd;
216
- emit("handleHistory");
217
- };
208
+ showChoice.value = false
209
+ userForm.value.name = choiceList.value[index].user
210
+ userForm.value.pwd = choiceList.value[index].pwd
211
+ emit('handleHistory')
212
+ }
218
213
 
219
214
  /**
220
215
  * 长按操作历史账户
@@ -224,21 +219,18 @@ const btnChoiceClick = (index: number) => {
224
219
  const extensionFun = (index: number, username: string) => {
225
220
  switch (index) {
226
221
  case 0:
227
- const i = choiceList.value.findIndex((item) => item.user === username);
228
- choiceList.value.splice(i, 1);
229
- uni.setStorageSync(
230
- `${props.prefix}_choiceList`,
231
- encryptData(choiceList.value),
232
- );
233
- break;
222
+ const i = choiceList.value.findIndex((item) => item.user === username)
223
+ choiceList.value.splice(i, 1)
224
+ uni.setStorageSync(`${props.prefix}_choiceList`, encryptData(choiceList.value))
225
+ break
234
226
  default:
235
- break;
227
+ break
236
228
  }
237
- };
229
+ }
238
230
 
239
231
  defineExpose({
240
232
  loginFn,
241
- });
233
+ })
242
234
  </script>
243
235
 
244
236
  <style lang="scss" scoped>
@@ -28,8 +28,8 @@
28
28
  <view v-if="!slots.left" class="hy-swipe-action--right__action">
29
29
  <view
30
30
  class="hy-swipe-action--right__action-btn"
31
- :style="item.style"
32
31
  v-for="(item, i) in options"
32
+ :style="item.style"
33
33
  @tap.stop="onActiveClick(item, i)"
34
34
  >
35
35
  {{ item.text }}
@@ -61,10 +61,15 @@ import {
61
61
  ref,
62
62
  watch,
63
63
  useSlots,
64
- PropType,
64
+ type PropType,
65
65
  } from 'vue'
66
- import type { ISwipeActionEmits } from './typing'
67
- import type { SwipeActionStatus, SwipeActionPosition, SwipeActionReason } from './typing'
66
+ import type {
67
+ ISwipeActionEmits,
68
+ SwipeActionStatus,
69
+ SwipeActionPosition,
70
+ SwipeActionReason,
71
+ SwipeActionOptionsVo,
72
+ } from './typing'
68
73
  import { useTouch } from '../../composables'
69
74
  import { closeOther, pushToQueue, removeFromQueue } from './index'
70
75
  import { getRect, guid } from '../../utils'
@@ -81,7 +86,7 @@ const props = defineProps({
81
86
  * 滑动按钮的状态,使用v-model进行双向绑定。
82
87
  * @values left,close,right
83
88
  * */
84
- modelValue: String,
89
+ modelValue: String as PropType<SwipeActionStatus>,
85
90
  /** 是否禁用滑动操作 */
86
91
  disabled: {
87
92
  type: Boolean,
@@ -94,7 +99,7 @@ const props = defineProps({
94
99
  },
95
100
  /** 右侧按钮内容 */
96
101
  options: {
97
- type: Array as unknown as PropType<SwipeActionStatus>,
102
+ type: Array as unknown as PropType<SwipeActionOptionsVo[]>,
98
103
  default: () => [
99
104
  {
100
105
  text: '收藏',
@@ -115,6 +120,8 @@ const props = defineProps({
115
120
  type: Number,
116
121
  default: 300,
117
122
  },
123
+ /** 关闭滑动按钮前的钩子函数 */
124
+ beforeClose: Function,
118
125
  })
119
126
  const emit = defineEmits<ISwipeActionEmits>()
120
127
  const leftClass = `hy-swipe-action--left--${guid()}`
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
2
 
3
- interface SwipeActionOptionsVo {
3
+ export interface SwipeActionOptionsVo {
4
4
  text: string
5
5
  style?: CSSProperties
6
6
  icon?: string
@@ -57,10 +57,11 @@ export default {
57
57
  </script>
58
58
 
59
59
  <script setup lang="ts">
60
- import { computed, ref, toRefs, watch, nextTick } from 'vue'
60
+ import { computed, ref, toRefs, watch, nextTick, inject } from 'vue'
61
61
  import type { CSSProperties, PropType } from 'vue'
62
62
  import type { ITextareaEmits } from './typing'
63
63
  import { addUnit } from '../../utils'
64
+ import { FormItemContext } from '@/package/components/hy-form-item/typing'
64
65
 
65
66
  /**
66
67
  * 用于输入多行文本信息,聊天输入框等。
@@ -177,6 +178,7 @@ const props = defineProps({
177
178
  })
178
179
  const { modelValue, customStyle, border, disabled, formatter } = toRefs(props)
179
180
  const emit = defineEmits<ITextareaEmits>()
181
+ const formItem = inject<FormItemContext>('formItem')
180
182
 
181
183
  // 输入框的值
182
184
  const innerValue = ref<string>('')
@@ -249,16 +251,17 @@ const onFocus = (e: FocusEvent) => {
249
251
  isFocus.value = true
250
252
  emit('focus', e)
251
253
  }
252
- const onBlur = (e: FocusEvent) => {
254
+ const onBlur = (e: any) => {
253
255
  isFocus.value = false
254
256
  emit('blur', e)
257
+ formItem.handleBlur(e.detail.value)
255
258
  // 尝试调用u-form的验证方法
256
259
  // formValidate(this, "blur");
257
260
  }
258
- const onLinechange = (e: Event) => {
259
- emit('linechange', e)
261
+ const onLinechange = (e: any) => {
262
+ emit('lineChange', e)
260
263
  }
261
- const onInput = (e: Event) => {
264
+ const onInput = (e: any) => {
262
265
  let { value } = e?.detail
263
266
  // 格式化过滤方法
264
267
  const format = formatter.value || innerFormatter
@@ -280,8 +283,7 @@ const valueChange = () => {
280
283
  // 标识value值的变化是由内部引起的
281
284
  changeFromInner.value = true
282
285
  emit('change', value)
283
- // 尝试调用u-form的验证方法
284
- // formValidate(this, "change");
286
+ formItem.handleChange(value)
285
287
  })
286
288
  }
287
289
  const onConfirm = (e: Event) => {
@@ -36,7 +36,7 @@ export interface ITextareaEmits {
36
36
  /** 点击完成时, 触发 confirm 事件 */
37
37
  (e: 'confirm', event: any): void
38
38
  /** 输入框行数变化时调用 */
39
- (e: 'linechange'): void
39
+ (e: 'lineChange', event: any): void
40
40
  /** 当键盘输入时,触发 input 事件 */
41
41
  (e: 'update:modelValue', value: string): void
42
42
  /** 键盘高度发生变化的时候触发此事件 */
@@ -19,7 +19,9 @@ import HyDropdownItem from './hy-dropdown-item/hy-dropdown-item.vue'
19
19
  import YkEmpty from './hy-empty/hy-empty.vue'
20
20
  import YkFloatButton from './hy-float-button/hy-float-button.vue'
21
21
  import HyFoldingPanel from './hy-folding-panel/hy-folding-panel.vue'
22
- import HyForm from './hy-form/hy-form.vue'
22
+ import HyForm from '@/package/components/hy-form-group/hy-form.vue'
23
+ import HyFormSimple from '@/package/components/hy-form/hy-form-simple.vue'
24
+ import HyFormItem from './hy-form-item/hy-form-item.vue'
23
25
  import HyGrid from './hy-grid/hy-grid.vue'
24
26
  import HyIcon from './hy-icon/hy-icon.vue'
25
27
  import HyImage from './hy-image/hy-image.vue'
@@ -80,6 +82,8 @@ const install = (Vue: any) => {
80
82
  Vue.component('YkFloatButton', YkFloatButton)
81
83
  Vue.component('HyFoldingPanel', HyFoldingPanel)
82
84
  Vue.component('HyForm', HyForm)
85
+ Vue.component('HyFormSimple', HyFormSimple)
86
+ Vue.component('HyFormItem', HyFormItem)
83
87
  Vue.component('HyGrid', HyGrid)
84
88
  Vue.component('HyIcon', HyIcon)
85
89
  Vue.component('HyImage', HyImage)
@@ -139,6 +143,8 @@ export {
139
143
  YkFloatButton,
140
144
  HyFoldingPanel,
141
145
  HyForm,
146
+ HyFormSimple,
147
+ HyFormItem,
142
148
  HyGrid,
143
149
  HyIcon,
144
150
  HyImage,
package/global.d.ts CHANGED
@@ -24,7 +24,9 @@ declare module 'vue' {
24
24
  HyEmpty: (typeof import('./components/hy-empty/hy-empty.vue'))['default']
25
25
  HyFloatButton: (typeof import('./components/hy-float-button/hy-float-button.vue'))['default']
26
26
  HyFloatingPanel: (typeof import('./components/hy-floating-panel/hy-floating-panel.vue'))['default']
27
- HyForm: (typeof import('./components/hy-form/hy-form.vue'))['default']
27
+ HyForm: (typeof import('@/package/components/hy-form-group/hy-form.vue'))['default']
28
+ HyFormItem: (typeof import('./components/hy-form-item/hy-form-item.vue'))['default']
29
+ HyFormGroup: (typeof import('./components/hy-form-group/hy-form-group.vue'))['default']
28
30
  HyGrid: (typeof import('./components/hy-grid/hy-grid.vue'))['default']
29
31
  HyIcon: (typeof import('./components/hy-icon/hy-icon.vue'))['default']
30
32
  HyImage: (typeof import('./components/hy-image/hy-image.vue'))['default']
@@ -11,6 +11,7 @@
11
11
  }
12
12
  }
13
13
 
14
+ /* 加上-- */
14
15
  @mixin m($modifier) {
15
16
  $selector: &;
16
17
  $currentSelector: '';
@@ -29,7 +30,7 @@
29
30
  }
30
31
  }
31
32
 
32
- /* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
33
+ /* 定义元素(e)__,对于伪类,会自动将 e 嵌套在 伪类 底下 */
33
34
  @mixin e($element...) {
34
35
  $selector: &;
35
36
  $selectors: "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.18",
4
- "description": "bug修复",
3
+ "version": "0.3.0",
4
+ "description": "添加分离式表单组件",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
package/utils/inspect.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @description 判断字符串是否是数字
3
- * @param {string | number} text 值
4
- * @return {boolean}
3
+ * @param {String | Number} text 值
4
+ * @return {Boolean}
5
5
  * */
6
6
  export const isNumericString = (text: string | number): boolean => {
7
7
  return typeof text === 'string' && !isNaN(Number(text))
@@ -9,8 +9,8 @@ export const isNumericString = (text: string | number): boolean => {
9
9
 
10
10
  /**
11
11
  * @description 判断是否是数字
12
- * @param {string | number} text 值
13
- * @return {boolean}
12
+ * @param {String | Number} text 值
13
+ * @return {Boolean}
14
14
  * */
15
15
  export const isNumber = (text: string | number): boolean => {
16
16
  return typeof text === 'number' || isNumericString(text)
@@ -18,8 +18,8 @@ export const isNumber = (text: string | number): boolean => {
18
18
 
19
19
  /**
20
20
  * @description 判断是否数组
21
- * @param arr 传入数组值
22
- * @return {boolean}
21
+ * @param {any} arr 传入数组值
22
+ * @return {Boolean}
23
23
  */
24
24
  export const isArray = (arr: any): arr is Array<any> => {
25
25
  // 如果 Array.isArray 函数可用,直接使用该函数检查
@@ -33,12 +33,32 @@ export const isArray = (arr: any): arr is Array<any> => {
33
33
  /**
34
34
  * @description 判断是否对象
35
35
  * @param obj 传入对象值
36
- * @return {boolean}
36
+ * @return {Boolean}
37
37
  */
38
38
  export const isObject = (obj: any): obj is Object => {
39
39
  return Object.prototype.toString.call(obj) === '[object Object]'
40
40
  }
41
41
 
42
+ /**
43
+ * @description 是否为base64图片
44
+ * @param {String} url
45
+ * @return
46
+ */
47
+ export function isBase64Image(url: string) {
48
+ // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
49
+ return /^data:image\/(png|jpg|jpeg|gif|bmp);base64,/.test(url)
50
+ }
51
+
52
+ /**
53
+ * @description 是否图片
54
+ * @param {String} url
55
+ * @return
56
+ */
57
+ export function isImage(url: string) {
58
+ // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
59
+ return /(\.jpg|\.jpeg|\.png|\.gif|\.bmp|\.webp)$/i.test(url)
60
+ }
61
+
42
62
  /**
43
63
  * 是否视频格式
44
64
  * @param {String} value
@@ -50,7 +70,7 @@ export function isVideo(value: string): boolean {
50
70
 
51
71
  /**
52
72
  * 判断是否是日期格式
53
- * @param {number | string} value yyyy-mm-dd hh:mm:ss 或 时间戳
73
+ * @param {Number | String} value yyyy-mm-dd hh:mm:ss 或 时间戳
54
74
  */
55
75
  export const isDate = (value: string | number) => {
56
76
  if (!value) return false
@@ -88,7 +108,7 @@ export const isDate = (value: string | number) => {
88
108
 
89
109
  /**
90
110
  * @description 验证是否是手机号格式
91
- * @param phone {string} 手机号
111
+ * @param {String} phone 手机号
92
112
  */
93
113
  export const isPhone = (phone: string): boolean => {
94
114
  return /^1[23456789]\d{9}$/.test(phone)
@@ -96,8 +116,8 @@ export const isPhone = (phone: string): boolean => {
96
116
 
97
117
  /**
98
118
  * @description 验证身份证号码
99
- * @param idCard {string} 身份证号
100
- * @return {boolean}
119
+ * @param {String} idCard 身份证号
120
+ * @return {Boolean}
101
121
  */
102
122
  export const isIdCard = (idCard: string): boolean => {
103
123
  return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(idCard)
@@ -105,34 +125,14 @@ export const isIdCard = (idCard: string): boolean => {
105
125
 
106
126
  /**
107
127
  * @description 验证是否是中文
108
- * @param {string} zh 校验值
109
- * @return {boolean}
128
+ * @param {String} zh 校验值
129
+ * @return {Boolean}
110
130
  */
111
131
  export const isChinese = (zh: string): boolean => {
112
132
  const reg = /^[\u4e00-\u9fa5]+$/gi
113
133
  return reg.test(zh)
114
134
  }
115
135
 
116
- /**
117
- * @description 是否为base64图片
118
- * @param {string} url
119
- * @return
120
- */
121
- export function isBase64Image(url: string) {
122
- // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
123
- return /^data:image\/(png|jpg|jpeg|gif|bmp);base64,/.test(url)
124
- }
125
-
126
- /**
127
- * @description 是否图片
128
- * @param {string} url
129
- * @return
130
- */
131
- export function isImage(url: string) {
132
- // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
133
- return /(\.jpg|\.jpeg|\.png|\.gif|\.bmp|\.webp)$/i.test(url)
134
- }
135
-
136
136
  /**
137
137
  * @description 判断环境是否是H5
138
138
  */
package/utils/utils.ts CHANGED
@@ -364,7 +364,7 @@ export type RectResultType<T extends boolean> = T extends true ? UniApp.NodeInfo
364
364
  * @param ins 在微信小程序里,因为utils文件里面获取不到instance值所以必须通过ins这个传过来
365
365
  * @param useFields 是否使用 fields 方法获取节点信息
366
366
  */
367
- const getRect = (
367
+ const getRect = <T extends boolean>(
368
368
  selector: string,
369
369
  all?: T,
370
370
  ins?: any,
@@ -395,24 +395,6 @@ const getRect = (
395
395
  } else {
396
396
  query[method](selector).boundingClientRect(callback).exec()
397
397
  }
398
- // // #ifdef MP-WEIXIN
399
- // instance = ins;
400
- // // #endif
401
- // // #ifndef APP-NVUE
402
- // uni
403
- // .createSelectorQuery()
404
- // .in(instance)
405
- // [all ? "selectAll" : "select"](selector)
406
- // .boundingClientRect((rect) => {
407
- // if (all && Array.isArray(rect) && rect.length) {
408
- // resolve(rect as UniApp.NodeInfo[]);
409
- // }
410
- // if (!all && rect) {
411
- // resolve(rect as UniApp.NodeInfo);
412
- // }
413
- // })
414
- // .exec();
415
- // // #endif
416
398
  })
417
399
  }
418
400