DatetimePicker.js 中的 clear 方法为什么不直接set value to null, 然后再emit出去?
Ouverte
component/datetime
- Langage dominant
- Vue
- Étoiles
- 17.5k
- Forks
- 3.6k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
请教一下,为什么 DatetimePicker.prototype.clear 方法不直接 this.value = null, 而一定要在所有引用Datetime 组件的地方手工传入 on-clear 函数?这样感觉有点麻烦且重复劳动, on-clear 函数应该是做在value清空时后续custom操作的地方。
src/components/datetime/datetimepicker.js
```
clear () {
const value = this.getValue()
// this.value = null //这样写会有什么问题么?本来就是clear函数,清空value就是它应该做的事情
if (this.config.onClear.call(this, null) === false) {
return
}
this.hide('clear')
}
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.