我正在修复这方面的bug &我不断得到“期待一个赋值或函数调用,而不是看到一个表达式”错误。
const CHARTID = "chart_id";
const FIELDID = "field_id";
const TIMEFILTERVALUE= "time_filter_input";
const TIMEFILTERUNIT = "time_filter_type"
const UNITFILTER = "unit_filter";
const constrcutFilterOptions = (field_id, chartId, timeFilterType, timeFilterUnit, unit)=> {
var filterObj = {};
!_.isNil(field_id) ? filterObj[FIELDID] = field_id : null;
!_.isNil(chartId) ? filterObj[CHARTID] = chartId : null;
!_.isNil(timeFilterType) ? filterObj[TIMEFILTERUNIT] = timeFilterType : null;
!_.isNil(timeFilterUnit) ? filterObj[TIMEFILTERVALUE] = timeFilterUnit : null;
!_.isNil(unit) ? filterObj[UNITFILTER] = unit : null;
return filterObj;
}
2条答案
按热度按时间eyh26e7m1#
你应该在三元条件之前写作业:
kkbh8khc2#
试着写if条件语句,而不是写一个表达式,例如:{ nextCell?.getElementsByTagName(“input”)?.length > 0?nextCell?.getElementsByTagName(“input”)[0].focus():nextCell?.getElementsByTagName(“select”)?.length > 0?nextCell?.getElementsByTagName(“select”)[0].focus():“"; } solution:- function setKeyboardTabEvent(nextCell:()=> void{ return()=>{ if(nextCell?.getElementsByTagName(“input”)?.length > 0){ nextCell?.getElementsByTagName(“input”)[0].focus();} if(nextCell?.getElementsByTagName(“select”)?.length > 0){ nextCell?.getElementsByTagName(“select”)[0].focus();} };