mirror of
https://gitee.com/mirrors/AllinSSL.git
synced 2026-03-13 01:50:53 +08:00
【调整】前后空格移除的方法和调整部分提示不准确的问题
This commit is contained in:
17
frontend/apps/allin-ssl/src/lib/utils.tsx
Normal file
17
frontend/apps/allin-ssl/src/lib/utils.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @description 移除输入框中的空格
|
||||
* @param {string} value 输入框的值
|
||||
* @returns {boolean} 是否为空
|
||||
*/
|
||||
export const noSideSpace = (value: string) => {
|
||||
return !value.startsWith(' ') && !value.endsWith(' ')
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 数字验证
|
||||
* @param {string} value 输入框的值
|
||||
* @returns {boolean} 是否为数字
|
||||
*/
|
||||
export const onlyAllowNumber = (value: string) => {
|
||||
return !value || /^\d+$/.test(value)
|
||||
}
|
||||
Reference in New Issue
Block a user