You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this exercise, we want to add a tooltip to the `<button>` using the [`Tippy.js`](https://atomiks.github.io/tippyjs/)library. The action is already wired up with `use:tooltip`, but if you hover over the button (or focus it with the keyboard) the tooltip contains no content.
First, the action needs to accept some options and pass them to Tippy:
9
+
最初に、アクションでオプションを受け取り、それを Tippy に渡さなければなりません:
10
10
11
11
```js
12
12
/// file: App.svelte
@@ -21,7 +21,7 @@ function tooltip(node, +++options+++) {
21
21
}
22
22
```
23
23
24
-
Then, we need to pass some options into the action:
24
+
それから、オプションをアクションに渡します:
25
25
26
26
```svelte
27
27
/// file: App.svelte
@@ -30,7 +30,7 @@ Then, we need to pass some options into the action:
30
30
</button>
31
31
```
32
32
33
-
The tooltip now works — almost. If we change the text in the `<input>`, the tooltip will not reflect the new content. We can fix that by adding an `update`method to the returned object.
@@ -22,7 +22,7 @@ First, add the `<audio>` element along with its bindings (we'll use the shorthan
22
22
/>
23
23
```
24
24
25
-
Next, add an event handler to the `<button>`that toggles `paused`:
25
+
次に、`paused` を切り替える `<button>`にイベントハンドラを追加します:
26
26
27
27
```svelte
28
28
/// file: AudioPlayer.svelte
@@ -33,7 +33,7 @@ Next, add an event handler to the `<button>` that toggles `paused`:
33
33
/>
34
34
```
35
35
36
-
Our audio player now has basic functionality. Let's add the ability to seek to a specific part of a track by dragging the slider. Inside the slider's `pointerdown`handler there's a `seek`function, where we can update `time`:
Copy file name to clipboardExpand all lines: content/tutorial/02-advanced-svelte/05-bindings/07-component-this/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
title: Binding to component instances
3
3
---
4
4
5
-
Just as you can bind to DOM elements, you can bind to component instances themselves with `bind:this`.
5
+
DOM 要素にバインドできるのと同じように、`bind:this` でコンポーネントインスタンス自体にバインドすることができます。
6
6
7
-
This is useful in the rare cases that you need to interact with a component programmatically (rather than by providing it with updated props). Revisiting our canvas app from [a few exercises ago](actions), it would be nice to add a button to clear the screen.
0 commit comments