</code></pre></div></li><li><p><strong>Details:</strong></p><p>You can customize how to read cache.</p></li><li><p><strong>参考:</strong> <a href="/guide/documentation/cacheKey.html#customcache" class="">Custom cache</a></p></li></ul><h3 id="errorretrycount" tabindex="-1"><a class="header-anchor" href="#errorretrycount" aria-hidden="true">#</a> errorRetryCount <span class="badge tip" style="vertical-align:top;"><!--[-->reactivity<!--]--></span></h3><ul><li><p><strong>Type:</strong> <code>number | Ref<number></code></p></li><li><p><strong>Default:</strong> <code>0</code></p></li><li><p><strong>Details:</strong></p><p>Maximum number of error retries.</p></li><li><p><strong>See also:</strong> <a href="/guide/documentation/errorRetry.html#errorretrycount" class="">ErrorRetryCount</a></p></li></ul><h3 id="errorretryinterval" tabindex="-1"><a class="header-anchor" href="#errorretryinterval" aria-hidden="true">#</a> errorRetryInterval <span class="badge tip" style="vertical-align:top;"><!--[-->reactivity<!--]--></span></h3><ul><li><p><strong>Type:</strong> <code>number | Ref<number></code></p></li><li><p><strong>Default:</strong> <code>0</code></p></li><li><p><strong>Details:</strong></p><p>By default, VueRequest uses the <a href="https://en.wikipedia.org/wiki/Exponential_backoff" target="_blank" rel="noopener noreferrer"><strong>Exponential Backoff Algorithm</strong><span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariaHidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a> to calculate the appropriate interval for you. You can also override the default behavior by setting <code>errorRetryInterval</code>.</p></li><li><p><strong>See also:</strong> <a href="/guide/documentation/errorRetry.html#errorretryinterval" class="">ErrorRetryInterval</a></p></li></ul><h3 id="manual" tabindex="-1"><a class="header-anchor" href="#manual" aria-hidden="true">#</a> manual</h3><ul><li><p><strong>Type:</strong> <code>boolean</code></p></li><li><p><strong>Default:</strong> <code>false</code></p></li><li><p><strong>Details:</strong></p><p>When <code>manual</code> is set to <code>true</code>, you need to manually trigger <a href="#run"><code>run</code></a> or <a href="#runAsync"><code>runAsync</code></a> to initiate the request.</p></li><li><p><strong>See also:</strong> <a href="/guide/documentation/manual.html" class="">Manually Trigger</a></p></li></ul><h3 id="defaultparams" tabindex="-1"><a class="header-anchor" href="#defaultparams" aria-hidden="true">#</a> defaultParams</h3><ul><li><p><strong>Type:</strong> <code>P[]</code></p></li><li><p><strong>Default:</strong> <code>[]</code></p></li><li><p><strong>Details:</strong></p><p>If <a href="#manual"><code>manual</code></a> is set to <code>false</code>, <code>defaultParams</code> will be used as the request parameters when the request is automatically executed.</p></li></ul><h3 id="ready" tabindex="-1"><a class="header-anchor" href="#ready" aria-hidden="true">#</a> ready <span class="badge tip" style="vertical-align:top;"><!--[-->reactivity<!--]--></span></h3><ul><li><p><strong>Type:</strong> <code>Ref<boolean> | () => boolean</code></p></li><li><p><strong>Default:</strong> <code>true</code></p></li><li><p><strong>Details:</strong></p><p>The request will only be sent when <code>ready</code> is <code>true</code>.</p><ul><li>Automatic mode: When <code>manual</code> is set to <code>false</code>, a request will be automatically sent every time <code>ready</code> changes from <code>false</code> to <code>true</code>, and the request will include the <code>options.defaultParams</code> parameters.</li><li>Manual mode: When <code>manual</code> is set to <code>true</code>, no request can be sent as long as <code>ready</code> is <code>false</code>.</li></ul></li><li><p><strong>See also:</strong> <a href="/guide/documentation/ready.html" class="">Dependent Request</a></p></li></ul><h3 id="initialdata" tabindex="-1"><a class="header-anchor" href="#initialdata" aria-hidden="true">#</a> initialData</h3><ul><li><p><strong>Type:</strong> <code>R</code></p></li><li><p><strong>Default:</strong> <code>undefined</code></p></li><li><p><strong>Details:</strong></p><p>Default value for <a href="#data"><code>data</code></a>.</p></li></ul><h3 id="refreshdeps" tabindex="-1"><a class="header-anchor" href="#refreshdeps" aria-hidden="true">#</a> refreshDeps</h3><ul><li><p><strong>Type:</strong> <code>WatchSource<any> | WatchSource<any>[]</code></p></li><li><p><strong>Default:</strong> <code>[]</code></p></li><li><p><strong>Details:</strong></p><p>When the contents of <code>refreshDeps</code> change and <a href="#refreshdepsaction"><code>refreshDepsAction</code></a> is not set, the <code>refresh</code> will be triggered to execute again. Essentially, this is just a wrapper for <a href="https://v3.vuejs.org/guide/computed.html#watchers" target="_blank" rel="noopener noreferrer"><code>watch</code><span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" ariaHidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span></a>.</p><div class="language-javascript ext-js"><pre class="language-javascript"><code><span class="token function">watch</span><span class="token punctuation">(</span>refreshDeps<span class="token punctuation">,</span> refresh<span class="token punctuation">)</span><span class="token punctuation">;</span>
0 commit comments