RN发送http请求例子
2021-05-17 16:28
标签:miss pen div min open method token 例子 error 发送http请求 日期选择器 时间选择 RN发送http请求例子 标签:miss pen div min open method token 例子 error 原文地址:http://www.cnblogs.com/simadi/p/7742826.html let map = {
method: ‘post‘,
headers: {
token: ‘‘,
‘Content-Type‘: ‘application/json‘
},
body: ‘‘
}
fetch(‘http://xxxx‘, map).then(
(result) => {
result.json().then(
(obj) => {
console.log(obj);
}
).catch(
(error) => {
console.log(error);
}
)
}
).catch(
(error) => {
console.log(error);
}
);
let option={date:new Date(),minDate:new Date(2012,1,28),maxDate:new Date(2020,1,28)};
DatePickerAndroid.open(option).then(
(result) => {
if(result.action===DatePickerAndroid.dismissedAction){
console.log(‘未选择‘);
}else
{
console.log(result);
}
}
).catch(
(error) => {
console.log(error);
}
);
let option={hour:13,minute:11};
TimePickerAndroid.open(option).then(
(result) => {
if(result.action===TimePickerAndroid.dismissedAction){
console.log(‘未选择‘);
}else
{
console.log(result);
}
}
).catch(
(error) => {
console.log(error);
}
);