Category · 43 articles

Template

Articles in the category Template.

Vue Tip: Avoid Empty Wrapper for Conditions Image

Vue Tip: Avoid Empty Wrapper for Conditions

There are many situations when you need to conditionally display multiple Vue components. To avoid "empty" wrappers you should use not use HTML tags.
Vue Tip: Delay Loading Appearance of Spinner Image

Vue Tip: Delay Loading Appearance of Spinner

Eager delay spinners are not a good user experience. They can make a snappy user interface feel slower. We want delay spinners to appear only after a perceivable delay.
Vue Tip: Check if Slot Is Empty Image

Vue Tip: Check if Slot Is Empty

You can check if a slot is empty, for example, only to render it if it has content.
Vue Tip: Memoize a Sub-Tree of the Template Using v-memo Image

Vue Tip: Memoize a Sub-Tree of the Template Using v-memo

The v-memo directive is like a computed prop for the template.
Vue Tip: Use Fallthrough Attributes Image

Vue Tip: Use Fallthrough Attributes

A 'fallthrough attribute' is an attribute or v-on event listener that is passed to a component, but is not explicitly declared in the receiving component's props or emits. Common examples of this include class, style, and id attributes.
Vue Tip: Provide Fallback Content for Slots Image

Vue Tip: Provide Fallback Content for Slots

There are cases when it's useful to specify fallback (i.e. default) content for a slot, to be rendered only when no content is provided.
Vue Tip: Use Optional Chaining in Templates Image

Vue Tip: Use Optional Chaining in Templates

It's possible to use optional chaining in Vue templates.
Vue Tip: Display Raw HTML Image

Vue Tip: Display Raw HTML

The double mustaches interpret the data as plain text, not HTML. To output real HTML, you will need to use the v-html directive.
Vue Tip: Use Teleport to Render a Component in a Different Place Image

Vue Tip: Use Teleport to Render a Component in a Different Place

With teleport, you can render a component in a different place in the DOM tree, even if this place is not in your app's scope.
Vue Tip: Simple Expressions in Templates Image

Vue Tip: Simple Expressions in Templates

Vue component templates should only include simple expressions, with more complex expressions refactored into computed properties or methods.