原来一直用 jQuery 。
最近上手 Vue.js ,感觉特爽。
可以部分脱离 jQuery 了。
非要直接操作 DOM 的 原生的 queryselector 感觉也够用了。
现在只剩下 XHR 这部分了,感觉不太喜欢 ES5 原生的。
所以求一个和 vuejs 配合使用的轻量 XHR js 库
原来一直用 jQuery 。
最近上手 Vue.js ,感觉特爽。
可以部分脱离 jQuery 了。
非要直接操作 DOM 的 原生的 queryselector 感觉也够用了。
现在只剩下 XHR 这部分了,感觉不太喜欢 ES5 原生的。
所以求一个和 vuejs 配合使用的轻量 XHR js 库
|
thinkifJan 8, 2016
1
|
|
oxyflourJan 8, 2016
2
window.fetch ?
https://developer.mozilla.org/en/docs/Web/API/Fetch_API |
|
ChiangDiJan 8, 2016
3
window.fetch ,在不支持的浏览器上有 polyfill https://github.com/github/fetch
|
|
doublleftJan 8, 2016
4
有机关枪不用,非要自己拿刀砍
|
|
oott123Jan 8, 2016
5
非要操作 DOM 还有 v-el 呢。
xhr 我比较喜欢 axios |
|
heraldboyJan 8, 2016
6
我总感觉如果不是特别必要,没有必要折腾各种框架。
|
|
loadingJan 8, 2016 via iPhone
7
你搜索 jquery 替代,知乎有。
|
|
8
直接使用 fetch API 不就足够了?
类似这样: fetch(`/api/resource/xxxxx`, { method: 'get', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }).then(res => { return res.json(); }).then(json => { console.log('result', result); } }).catch(error => { console.log('error: ', error); }); 只兼容 chrome 的话,这么写是很爽的。 [https://github.com/github/fetch]( https://github.com/github/fetch) |
|
alex321Jan 8, 2016
9
一般工作一段时间的前端都会直接封装好多常用的类库吧,那都是原生的啊。。。
|
|
void1900Jan 9, 2016
10
zepto
|