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
### Component name casing in JS/JSX <supdata-p="b">强烈推荐</sup>
901
+
### JS/JSX 中的组件名大小写 <supdata-p="b">强烈推荐</sup>
902
902
903
-
**Component names in JS/[JSX](../guide/render-function.html#JSX)should always be PascalCase, though may be kebab-case inside strings for simpler applications that only use global component registration through `Vue.component`.**
In JavaScript, PascalCase is the convention for classes and prototype constructors - essentially, anything that can have distinct instances. Vue components also have instances, so it makes sense to also use PascalCase. As an added benefit, using PascalCase within JSX (and templates) allows readers of the code to more easily distinguish between components and HTML elements.
**Component names should prefer full words over abbreviations.**
979
+
**组件名应该倾向于完整单词而不是缩写。**
980
980
981
-
The autocompletion in editors make the cost of writing longer names very low, while the clarity they provide is invaluable. Uncommon abbreviations, in particular, should always be avoided.
We're simply following the conventions of each language. Within JavaScript, camelCase is more natural. Within HTML, kebab-case is.
1009
+
我们单纯的遵循每个语言的约定。在 JavaScript 中更自然的是 camelCase。而在 HTML 中则是 kebab-case。
1010
1010
1011
1011
{% raw %}<divclass="style-example example-bad">{% endraw %}
1012
1012
#### 反例
@@ -1038,11 +1038,11 @@ props: {
1038
1038
1039
1039
1040
1040
1041
-
### Multi-attribute elements <supdata-p="b">强烈推荐</sup>
1041
+
### 多个特性的元素 <supdata-p="b">强烈推荐</sup>
1042
1042
1043
-
**Elements with multiple attributes should span multiple lines, with one attribute per line.**
1043
+
**多个特性的元素应该分多行撰写,每个特性一行。**
1044
1044
1045
-
In JavaScript, splitting objects with multiple properties over multiple lines is widely considered a good convention, because it's much easier to read. Our templates and [JSX](../guide/render-function.html#JSX)deserve the same consideration.
0 commit comments