当我从API接收到一些数据之后,我将值传递给DayPickerInput组件,但是之后onChange函数不起作用。仅当我从callendar手动输入值或选择日值时,onChange才起作用吗?如果我还有另一个输入是选择类型,当我选择某个值时,我希望将其传递给DayPickerInput怎么办?我应该如何使组件响应更改?
这是DayPickerInput组件的使用方式:
var urlCurrent = "www.example.com/web/americas/home";
var siteNames = ["americas","international","europe","asia-pacific","africa-middle-east","russia","india"];
var regex = new RegExp(siteNames.join('|'));
var match = urlCurrent.match(regex);
if(match) {
var url = urlCurrent.substr(0, match[0].length + match.index)
console.log(url);
} else {
//invalid url
}
因此inputProps中的onDayChange和onChange不会运行console.log()