Skip to content

Commit d72ae9b

Browse files
committed
refactor(Behavior): 增强 Validator 校验逻辑
1 parent 9def5ec commit d72ae9b

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

commitlint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ module.exports = {
6161
'Price',
6262
'Counter',
6363
'SearchBar',
64-
'IndexList'
64+
'IndexList',
65+
'Behavior'
6566
]
6667
]
6768
}

dist/behaviors/validator.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dist/behaviors/validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default Behavior({
1111
} = properties[name];
1212
if (options) {
1313
properties[name].observer = function (newValue) {
14-
if (!options.includes(newValue)) {
14+
if (!options.includes(newValue) && newValue) {
1515
console.error(`${name}: ${newValue} must be in the [${options}]`);
1616
}
1717
};

src/behaviors/validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default Behavior({
1111
} = properties[name];
1212
if (options) {
1313
properties[name].observer = function (newValue) {
14-
if (!options.includes(newValue)) {
14+
if (!options.includes(newValue) && newValue) {
1515
console.error(`${name}: ${newValue} must be in the [${options}]`);
1616
}
1717
};

0 commit comments

Comments
 (0)