RxJS 操作符 - ajax 发起异步请求
import { ajax } from 'rxjs/ajax'
import { map } from 'rxjs'
ajax({
url: 'https://httpbin.org/delay/2',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: 'Hello, World!',
})
.pipe(map(res => res.response.data))
.subscribe(console.log) // Hello World!