import{_ as s}from"./plugin-vue_export-helper-DlAUqK2U.js";import{c as n,a as o,o as i}from"./app-42vVvAb-.js";const a={};function l(t,e){return i(),n("div",null,e[0]||(e[0]=[o(`
Each component lives in a single file, containing:
template (the DOM structure)script (including props, data and methods among other things)style (defining the look of the component)See the Vue.js docs for more details.
Placed in the same folder are also:
MyComponent.spec.js)MyComponent.story.js)Vue.js allows us to define component props either as strings or as objects (with type and default or required values). Always go for the second option!
Also: only (and always!) define a default for props that are not required.
Why?
It is as easy as writing:
props: {
title: {
type: String,
required: true,
},
image: {
type: String,
default: 'human-connection-logo.png',
},
}For more complex use cases see the official Vue.js documentation.
For better readability we prefer
:something over v-bind:something@click over v-on:click#slotSame over v-slot:slotName#default over v-slotRead more in the official Vue.js docs (for slots)
The Vue.js component style guide offers a whole list of best-practices for writing Vue components.
`,21)]))}const p=s(a,[["render",l],["__file","vue.html.vue"]]),c=JSON.parse('{"path":"/webapp/vue.html","title":"Vue – Code Guidelines","lang":"en-US","frontmatter":{},"headers":[{"level":2,"title":"We use single-file components","slug":"we-use-single-file-components","link":"#we-use-single-file-components","children":[]},{"level":2,"title":"We use typed props","slug":"we-use-typed-props","link":"#we-use-typed-props","children":[]},{"level":2,"title":"We use shorthands","slug":"we-use-shorthands","link":"#we-use-shorthands","children":[]},{"level":2,"title":"Recommended reads","slug":"recommended-reads","link":"#recommended-reads","children":[]}],"git":{"createdTime":1752750935000,"updatedTime":1752750935000,"contributors":[{"name":"dependabot[bot]","email":"49699333+dependabot[bot]@users.noreply.github.com","commits":1}]},"readingTime":{"minutes":0.84,"words":252},"filePathRelative":"webapp/vue.md","localizedDate":"July 17, 2025","excerpt":"\\nEach component lives in a single file, containing:
\\ntemplate (the DOM structure)script (including props, data and methods among other things)style (defining the look of the component)