From b94a150588470c8d81c39b218e3bd28bdaf1c134 Mon Sep 17 00:00:00 2001 From: Naoki Endoh Date: Sat, 4 Dec 2021 17:11:58 +0900 Subject: [PATCH] docs: translate sfc style features --- src/api/sfc-style.md | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/api/sfc-style.md b/src/api/sfc-style.md index 2b3b4081..73f5dbfc 100644 --- a/src/api/sfc-style.md +++ b/src/api/sfc-style.md @@ -2,11 +2,11 @@ sidebarDepth: 1 --- -# SFC Style Features +# SFC スタイルの機能 ## ` ``` -The above will be compiled into: +上記は次のようにコンパイルされます: ```css .a[data-v-f3f3eg9] .b { @@ -59,12 +59,12 @@ The above will be compiled into: ``` :::tip -DOM content created with `v-html` are not affected by scoped styles, but you can still style them using deep selectors. +`v-html` で作られた DOM コンテンツは、スコープ付きスタイルの影響を受けませんが、ディープセレクタを使ってスタイルすることができます。 ::: -### Slotted Selectors +### スロットセレクタ -By default, scoped styles do not affect contents rendered by ``, as they are considered to be owned by the parent component passing them in. To explicitly target slot content, use the `:slotted` pseudo-class: +デフォルトでスコープ付きスタイルは、親コンポーネントが所有しているコンテンツとみなして、`` でレンダリングされたコンテンツに影響を与えません。スロットのコンテンツを明示的に対象にするには、`:slotted` 擬似クラスを使用できます: ```vue ``` -### Global Selectors +### グローバルセレクタ -If you want just one rule to apply globally, you can use the `:global` pseudo-class rather than creating another ` ``` -### Mixing Local and Global Styles +### ローカルとグローバルのスタイル併用 -You can also include both scoped and non-scoped styles in the same component: +スコープ付きとスコープなしのスタイルの両方を同じコンポーネントに含めることもできます: ```vue ``` -### Scoped Style Tips +### スコープ付きスタイルのヒント -- **Scoped styles do not eliminate the need for classes**. Due to the way browsers render various CSS selectors, `p { color: red }` will be many times slower when scoped (i.e. when combined with an attribute selector). If you use classes or ids instead, such as in `.example { color: red }`, then you virtually eliminate that performance hit. +- **スコープ付きスタイルでもクラスが不要になるわけではないです**。ブラウザがさまざまな CSS セレクタをレンダリングする方法のため、`p { color: red }` はスコープ付きの場合(例えば属性セレクタと合わせた場合)に何杯も遅くなります。`.example { color: red }` のようにクラスや ID を代わりに使えば、このパフォーマンスへの影響をほぼ解消することができます。 -- **Be careful with descendant selectors in recursive components!** For a CSS rule with the selector `.a .b`, if the element that matches `.a` contains a recursive child component, then all `.b` in that child component will be matched by the rule. +- **再帰的コンポーネントの子孫セレクタには注意が必要です!** `.a .b` セレクタを使った CSS ルールでは、`.a` に一致する要素に再帰的な子コンポーネントが含まれている場合、その子コンポーネントに含まれるすべての `.b` がルールに一致してしまいます。 ## ` ``` -The resulting classes are hashed to avoid collision, achieving the same effect of scoping the CSS to the current component only. +この結果として得られるクラスは、衝突を避けるためにハッシュ化され、CSS を現在のコンポーネントだけにスコープするのと同じ効果を実現します。 -Refer to the [CSS Modules spec](https://github.com/css-modules/css-modules) for more details such as [global exceptions](https://github.com/css-modules/css-modules#exceptions) and [composition](https://github.com/css-modules/css-modules#composition). +[Global exceptions](https://github.com/css-modules/css-modules#exceptions) や [Composition](https://github.com/css-modules/css-modules#composition) などの詳細については [CSS Modules の仕様](https://github.com/css-modules/css-modules) を参照してください。 -### Custom Inject Name +### カスタム注入名 -You can customize the property key of the injected classes object by giving the `module` attribute a value: +`module` 属性に値を指定することで、注入されたクラスオブジェクトのプロパティキーをカスタマイズできます: ```vue