diff --git a/src/common/utils.wxs b/src/common/utils.wxs index 3090b300d..1e023ebc3 100644 --- a/src/common/utils.wxs +++ b/src/common/utils.wxs @@ -124,6 +124,10 @@ function _style(styles) { return styles; } +function isValidIconName(str) { + return getRegExp('^[A-Za-z0-9\-]+$').test(str); +} + module.exports = { addUnit: addUnit, isString: isString, @@ -134,4 +138,5 @@ module.exports = { cls: cls, getBadgeAriaLabel: getBadgeAriaLabel, _style: _style, + isValidIconName: isValidIconName, }; diff --git a/src/icon/icon.wxml b/src/icon/icon.wxml index 914693992..bfa4de83e 100644 --- a/src/icon/icon.wxml +++ b/src/icon/icon.wxml @@ -11,5 +11,9 @@ - +