|
请教大佬,下面的代码怎么理解?
- // 单元格点击事件
- function Workbook_SheetSelectionChange(sheet, target) {
- Workbook_SheetSelectionChange = (() => {
- var picker = new Datepicker();
- return (sheet, target) => {
- if (sheet.Name != "Sheet1" || target.Count > 1) return
- target.Value2 = "'" + picker.text("yyyy年mm月dd日[$-0804]dddd");
- }
- })();
- Workbook_SheetSelectionChange(sheet, target);//忍不住,总是会理解成递归调用?
- }
复制代码
改写如下倒是可以理解了:
- // 单元格点击事件
- function Workbook_SheetSelectionChange(sheet, target) {
- test_fun = (() => {
- var picker = new Datepicker();
- return (sheet, target) => {
- if (sheet.Name != "Sheet1" || target.Count > 1) return
- target.Value2 = "'" + picker.text("yyyy年mm月dd日[$-0804]dddd");
- }
- })();
- test_fun(sheet, target);
- }
复制代码
|
|