index.js 590 B

12345678910111213141516171819202122232425
  1. var Switch = {
  2. _handleZanSwitchChange(e) {
  3. var dataset = e.currentTarget.dataset;
  4. var checked = !dataset.checked;
  5. var loading = dataset.loading;
  6. var disabled = dataset.disabled;
  7. var componentId = dataset.componentId;
  8. if (loading || disabled) return;
  9. console.info('[zan:switch:change]', { checked, componentId });
  10. if (this.handleZanSwitchChange) {
  11. this.handleZanSwitchChange({
  12. checked,
  13. componentId
  14. });
  15. } else {
  16. console.warn('页面缺少 handleZanSwitchChange 回调函数');
  17. }
  18. }
  19. };
  20. module.exports = Switch;