File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -81,16 +81,16 @@ Vue は、 `methods` の `this` を自動的に束縛して、常にコンポー
8181
8282### Debounce (デバウンス) と Throttle (スロットル)
8383
84- Vue は、 デバウンスやスロットルのサポートが組み込まれていませんが 、 [ Lodash] ( https://lodash.com/ ) などのライブラリを使って実装することができます。
84+ Vue は、 Debounce や Throttle のサポートが組み込まれていませんが 、 [ Lodash] ( https://lodash.com/ ) などのライブラリを使って実装することができます。
8585
86- コンポーネントが一度しか使われない場合には、 ` methods ` の中で直接デバウンスを適用することができます :
86+ コンポーネントが一度しか使われない場合には、 ` methods ` の中で直接 Debounce を適用することができます :
8787
8888``` html
8989<
script src =
" https://unpkg.com/[email protected] /lodash.min.js" ></
script >
9090<script >
9191 Vue .createApp ({
9292 methods: {
93- // Lodash によるデバウンス
93+ // Lodash による Debounce
9494 click: _ .debounce (function () {
9595 // ... クリックに反応 ...
9696 }, 500 )
@@ -99,12 +99,12 @@ Vue は、 デバウンスやスロットルのサポートが組み込まれて
9999 </script >
100100```
101101
102- しかし、この方法ではコンポーネントが再利用される場合に、すべてのコンポーネントが同じデバウンス関数を共有するため 、問題が起きる可能性があります。コンポーネントのインスタンスをお互いに独立させるために、 ` created ` ライフサイクルフックにデバウンス関数を追加することができます :
102+ しかし、この方法ではコンポーネントが再利用される場合に、すべてのコンポーネントが同じ Debounce 関数を共有するため 、問題が起きる可能性があります。コンポーネントのインスタンスをお互いに独立させるために、 ` created ` ライフサイクルフックに Debounce 関数を追加することができます :
103103
104104``` js
105105app .component (' save-button' , {
106106 created () {
107- // Lodash によるデバウンス
107+ // Lodash によるDebounce
108108 this .debouncedClick = _ .debounce (this .click , 500 )
109109 },
110110 unmounted () {
You can’t perform that action at this time.
0 commit comments