🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# vue中的回调函数 ``` <pre class="calibre15">``` <span class="token2">function</span> <span class="token3">test</span><span class="token1">(</span>aaa<span class="token1">,</span>bbb<span class="token1">)</span><span class="token1">{</span> <span class="token3">aaa</span><span class="token1">(</span><span class="token4">'helloworld'</span><span class="token1">)</span> <span class="token1">}</span> 相当于: <span class="token3">test</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span><span class="token1">}</span><span class="token1">,</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span><span class="token1">}</span><span class="token1">)</span> 思路逻辑: <span class="token3">aaa</span> <span class="token">=</span> <span class="token2">function</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span><span class="token1">}</span> <span class="token3">aaa</span><span class="token1">(</span><span class="token1">)</span>就是调用这个匿名函数 <span class="token3">aaa</span><span class="token1">(</span><span class="token4">'helloworld'</span><span class="token1">)</span> <span class="token">=</span> <span class="token2">function</span><span class="token1">(</span>res<span class="token1">)</span><span class="token1">{</span> <span class="token1">}</span> 相当于helloworld 传给了res ``` ```