Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify that :style can coexist with regular style attributes l… #2516

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/guide/essentials/class-and-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,20 @@ data() {

スタイルへのオブジェクトのバインディングも、オブジェクトを返す算出プロパティと組み合わせて使用することが多くあります。

`:class` と同様、`:style` ディレクティブは通常の style 属性と共存させることもできます。

テンプレート:

```vue-html
<h1 style="color: red" :style="'font-size: 1em'">hello</h1>
```

レンダリング結果:

```vue-html
<h1 style="color: red; font-size: 1em;">hello</h1>
```

### 配列へのバインディング {#binding-to-arrays-1}

`:style` は、複数のスタイルオブジェクトからなる配列にバインドすることができます。各オブジェクトはマージされ、同じ要素に適用されます:
Expand Down