A. Necessary
  1. Multiple-word for component’s name
  2. Data for component must be a function
  3. The definition of prop should be as detailed as possible (at least specified its type)
  4. Always use key with v-for
  5. Never use v-if & v-for to the same element (v-for has a higher priority than v-if when Vue deal with the directives)
  6. Set the scope for the component style, but use class rather than scoped feature
  7. Custom private attributes use the $_ prefix
B. Highlycommended
  1. Separate each component into files
  2. The filename of a single file component should always be either capitalized or always crosslinked
  3. The underlying components for which a particular style and convention are applied (that is, components that show classes, Illogical or stateless) should all begin with a specific prefix
  4. Components that are used only once per page should be named with “the” prefix
  5. Child components that are tightly coupled with the parent component (that means a component only makes sense in the context of a parent component) should be prefixed with the parent component name.
  6. Component names should begin with high-level (usually generic) words and end with descriptive modifiers.
  7. In single file components, string templates and components with no content in JSX should be self-closed-but never do so in DOM templates.
  8. For most projects, component names should always be PascalCase in single file components and string templates but always kebab-case in DOM templates
  9. The components name should be PascalCase in JS/JSX, but for applications that define global components only through Vue.component, kebab-case is recommended as an alternative
  10. Component names should tend to be full words instead of abbreviations
  11. When declaring prop, it should always be named with camelCase. But in templates & JSX you should use kebab-case
  12. Seprating multiple properties of an object by multiple rows that can improve the readability of the code
  13. Component templates should contain only simple expressions, and complex expressions should be refactored into computed properties or methods
  14. Divide complex computational attributes into as many simpler ones as possible
  15. Non-empty HTML attribute values should always be quoted
  16. Instruction abbreviation
C. Recommended 
  1. There should be a uniform order of options for components/instances (default order recommended:https://cn.vuejs.org/v2/style-guide/#%E7%BB%84%E4%BB%B6-%E5%AE%9E%E4%BE%8B%E7%9A%84%E9%80%89%E9%A1%B9%E7%9A%84%E9%A1%BA%E5%BA%8F-%E6%8E%A8%E8%8D%90)
  2. The properties of elements (including components) should have a uniform order (default order recommended: https://cn.vuejs.org/v2/style-guide/#%E5%85%83%E7%B4%A0%E7%89%B9%E6%80%A7%E7%9A%84%E9%A1%BA%E5%BA%8F-%E6%8E%A8%E8%8D%90)
  3. Adding blank lines between multiple attributes can improve readability when components begin to be dense or difficult to read
  4. Single-file components should always keep the script template and style tags in the same order. And style should be at the end, because the other two tags must have at least one.
D. Be Attention (to use these as follow)
  1. Use v-if/v-else-if/v-else without using key
  2. A large number of element selectors appear in scoped
  3. Hidden parent-child component communication (use this.$parent or modify prop)
  4. Global State Management without Flux (manage global state by using this.$root or a global event bus)

All these referred to  https://cn.vuejs.org/v2/style-guide/

Notes about Vue Style Guide的更多相关文章

  1. Google C++ Style Guide

    Background C++ is one of the main development languages used by many of Google's open-source project ...

  2. python coding style guide 的高速落地实践

    python coding style guide 的高速落地实践 机器和人各有所长,如coding style检查这样的可自己主动化的工作理应交给机器去完毕,故发此文帮助你在几分钟内实现coding ...

  3. python coding style guide 的快速落地实践——业内python 编码风格就pep8和谷歌可以认作标准

    python coding style guide 的快速落地实践 机器和人各有所长,如coding style检查这种可自动化的工作理应交给机器去完成,故发此文帮助你在几分钟内实现coding st ...

  4. 与你相遇好幸运,The Moe Node.js Code Style Guide

    The Moe Node.js Code Style Guide  By 一个最萌的开发者 @2016.9.21 >>代码是人来阅读的,格式规范的代码是对编程人员最好的礼物 :) > ...

  5. 使用tdcss.js轻松制作自己的style guide

    http://jakobloekke.github.io/tdcss.js/ 在前端开发中,如果能够有一个style guide对于设计来说就显得专业稳定,一致性.在上述链接中,有一个tdcss.js ...

  6. Google C++ Style Guide在C++11普及后的变化

    转 http://www.cnblogs.com/chen3feng/p/5972967.html?from=timeline&isappinstalled=0&lwfrom=user ...

  7. Common Lisp Style Guide - Ariel Networks Labs

    Common Lisp Style Guide - Ariel Networks Labs Common Lisp Style Guide

  8. 一张图总结Google C++编程规范(Google C++ Style Guide)

    Google C++ Style Guide是一份不错的C++编码指南,我制作了一张比較全面的说明图,能够在短时间内高速掌握规范的重点内容.只是规范毕竟是人定的,记得活学活用.看图前别忘了阅读以下三条 ...

  9. Airbnb JavaScript Style Guide

      Airbnb JavaScript Style Guide() { 用更合理的方式写 JavaScript    ES5 的编码规范请查看版本一,版本二. 翻译自 Airbnb JavaScrip ...

随机推荐

  1. SDUT OJ 字典树 AND 静态内存与动态内存

    字典树 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 遇到单词不认识怎么办? 查字典 ...

  2. CodeForces - 233A Perfect Permutation

    A. Perfect Permutation time limit per test: 2 seconds memory limit per test: 256 megabytes input: st ...

  3. python wraps装饰器

    这是一个很有用的装饰器.看过前一篇反射的朋友应该知道,函数是有几个特殊属性比如函数名,在被装饰后,上例中的函数名foo会变成包装函数的名字 wrapper,如果你希望使用反射,可能会导致意外的结果.这 ...

  4. python之文件读写(2)

    2. 写入数据到文件中 读取文件用read,那么写用什么嘞?用write!实际操作一下. 2.1 简单的写入数据到文件中 file = open("write_data", &qu ...

  5. POJ_3414 Pots 【复杂BFS】

    一.题面 You are given two pots, having the volume of A and B liters respectively. The following operati ...

  6. HDU_6298 Maximum Multiple 【找规律】

    一.题目 Given an integer $n$, Chiaki would like to find three positive integers $x$, $y$ and $z$ such t ...

  7. P2762 太空飞行计划问题

    传送门 经典的最大权闭合子图问题 实验有正的价值,仪器的价值为负 为了实验我们必须选择相应的仪器 所以从 S 连向实验,边权为实验的价值 实验与相应仪器之间连边,边权为 INF 仪器连向 T 边权为仪 ...

  8. leetcode 493 Reverse Pairs

    题意:给定一个数组nums,求若 i<j and nums[i] > 2*nums[j] 的逆序对. Note: 数组的长度不会超过50,000 不愧是hard模式的题目,虽然已经知道可以 ...

  9. no git binary found in $path(已解决,但是还有疑问)

    跟同行研究个项目代码,他把代码打包发我后,我解压到本地,路径和我本地个人项目路径基本相同, 但是当执行npm install时,就报了 no git binary found in $path ,这个 ...

  10. IOS不支持overflow: hidden;

    IOS不支持overflow: hidden; 假设页面上有个弹出窗,弹出窗出现后,只想让用户的视觉锁定在弹出窗上,正常我们会想到用overflow:hidden这个属性来实现,如下 html{ ov ...