我完成了 Vue.js 的学习,它几乎拥有了我想要的一切!但是我找不到类似于 redux-saga 的东西。这是一个非常棒的工具,如果有这样的东西就好了。
有人可以提出替代库,或分享如何在没有 redux-saga 的情况下管理具有复杂数据流的大型项目的经验。
有人尝试将 Redux-saga 连接到 Vue 并使用它(例如使用该库)?体验如何?
例如,我如何使用XMLHttpRequest? 查询和 serverUrl 如下:
const serverUrl = 'http://example.com/graphql/'
const query = {
query: `{
viewer {
date
}
}`
};
Run Code Online (Sandbox Code Playgroud) 有一种方法来获取与有条件的东西GQL使用@include(if: $withFriends)
query Hero($episode: Episode, $withFriends: Boolean!) {
hero(episode: $episode) {
name
friends @include(if: $withFriends) {
name
}
}
}
Run Code Online (Sandbox Code Playgroud)
但如果$withFriends是假的,我想获取其他东西。我可以通过传递额外的变量来实现它$notWithFriends
query Hero($episode: Episode, $withFriends: Boolean!) {
hero(episode: $episode) {
name
friends @include(if: $withFriends) {
name
}
appearsIn @include(if: $notWithFriends)
}
}
Run Code Online (Sandbox Code Playgroud)
像这样:@include(else: $withFriends)或@include(ifNot: $withFriends)或@include(if: !$withFriends)
javascript ×3
graphql ×2
apollo ×1
chartist.js ×1
redux-saga ×1
relay ×1
svg ×1
vue.js ×1
vuejs2 ×1
vuex ×1