Skip to content

Instantly share code, notes, and snippets.

@randName
Created February 4, 2020 09:42
Show Gist options
  • Save randName/4bea4a4d570302e185c07da4e3221fab to your computer and use it in GitHub Desktop.
Save randName/4bea4a4d570302e185c07da4e3221fab to your computer and use it in GitHub Desktop.

The most important part of the style guide

Component/instance options order

  1. Side Effects (triggers effects outside the component)
  • el
  1. Global Awareness (requires knowledge beyond the component)
  • name, parent
  1. Component Type (changes the type of the component)
  • functional
  1. Template Modifiers (changes the way templates are compiled)
  • delimiters, comments
  1. Template Dependencies (assets used in the template)
  • components, directives, filters
  1. Composition (merges properties into the options)
  • extends, mixins
  1. Interface (the interface to the component)
  • inheritAttrs, model, props/propsData
  1. Local State (local reactive properties)
  • data, computed
  1. Events (callbacks triggered by reactive events)
  • watch
  • beforeCreate, created, beforeMount, mounted
  • beforeUpdate, updated, activated
  • deactivated, beforeDestroy, destroyed
  1. Non-Reactive Properties (instance properties independent of the reactivity system)
  • methods
  1. Rendering (the declarative description of the component output)
  • template/render, renderError

Element attribute order

  1. Definition (provides the component options)
  • is
  1. List Rendering (creates multiple variations of the same element)
  • v-for
  1. Conditionals (whether the element is rendered/shown)
  • v-if/v-else-if/v-else, v-show, v-cloak
  1. Render Modifiers (changes the way the element renders)
  • v-pre, v-once
  1. Global Awareness (requires knowledge beyond the component)
  • id
  1. Unique Attributes (attributes that require unique values)
  • ref, key
  1. Two-Way Binding (combining binding and events)
  • v-model
  1. Other Attributes
  • all unspecified bound & unbound attributes
  1. Events (component event listeners)
  • v-on
  1. Content (overrides the content of the element)
  • v-html, v-text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment