Skip to content

Commit ce6794d

Browse files
committed
docs: clarify that :style can coexist with regular style attributes like class
1 parent 2647b0b commit ce6794d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/guide/essentials/class-and-style.md

+14
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,20 @@ data() {
323323

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

326+
`:class` と同様、`:style` ディレクティブは通常の style 属性と共存させることもできます。
327+
328+
テンプレート:
329+
330+
```vue-html
331+
<h1 style="color: red" :style="'font-size: 1em'">hello</h1>
332+
```
333+
334+
レンダリング結果:
335+
336+
```vue-html
337+
<h1 style="color: red; font-size: 1em;">hello</h1>
338+
```
339+
326340
### 配列へのバインディング {#binding-to-arrays-1}
327341

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

0 commit comments

Comments
 (0)