Skip to content

Commit 208b30d

Browse files
authored
Merge pull request #273 from Peter-WF/2.0-cn
add "class-and-style.md" translated base on issue#272
2 parents c5645b8 + 603c448 commit 208b30d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,39 +109,39 @@ data: {
109109
<div v-bind:class="[{ active: isActive }, errorClass]">
110110
```
111111

112-
### With Components
112+
### 组件语法
113113

114-
> This section assumes knowledge of [Vue Components](components.html). Feel free to skip it and come back later.
114+
> 这部分内容是假定你已经了解了 [Vue Components](components.html) 相关知识。你可以暂时跳过这里,随后再来阅读。
115115
116-
When you use the `class` attribute on a custom component, those classes will be added to the component's root element. Existing classes on this element will not be overwritten.
116+
当你在一个自定义组件上使用 `class` 属性时,那些添加的 class 值将会被添加至组件根元素上。根元素上已存在的 class 值将不会被覆盖。
117117

118-
For example, if you declare this component:
118+
例如,如果你声明一个这样的组件:
119119

120120
``` js
121121
Vue.component('my-component', {
122122
template: '<p class="foo bar">Hi</p>'
123123
})
124124
```
125125

126-
Then add some classes when using it:
126+
随后在上面添加一些 class:
127127

128128
``` html
129129
<my-component class="baz boo"></my-component>
130130
```
131131

132-
The rendered HTML will be:
132+
渲染为:
133133

134134
``` html
135135
<p class="foo bar baz boo">Hi</p>
136136
```
137137

138-
The same is true for class bindings:
138+
这里我们同样可以用 class 绑定的形式:
139139

140140
``` html
141141
<my-component v-bind:class="{ active: isActive }"></my-component>
142142
```
143143

144-
When `isActive` is truthy, the rendered HTML will be:
144+
`isActive` 是 true 时, 渲染的 HTML 将会是:
145145

146146
``` html
147147
<div class="foo bar active"></div>

0 commit comments

Comments
 (0)