Skip to content

Commit ff56b44

Browse files
center1024Tidyzq
authored andcommitted
Update validator.ts
在微信小程序中使用会报错 Uncaught (in promise) thirdScriptError Cannot read property 'replace' of undefined TypeError: Cannot read property 'replace' of undefined
1 parent 47d9590 commit ff56b44

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/form/validator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default {
121121
bytelength(r, value, param) {
122122
param = r.param
123123
// eslint-disable-next-line no-control-regex
124+
value = value || ''
124125
const len = value.replace(/[^\x00-\xff]/g, '**').length
125126
if (len > param) {
126127
return sprintf(r.message || defaultMessage.bytelength, param)

0 commit comments

Comments
 (0)