Category · 43 articles

Template

Articles in the category Template.

Vue Tip: Change the Interpolation Delimiter Image

Vue Tip: Change the Interpolation Delimiter

It is possible to adjust the delimiters used for text interpolation within the template to avoid conflicting with server-side frameworks that also use mustache syntax.
Vue Tip: Use Vue Without Build Step Image

Vue Tip: Use Vue Without Build Step

When using Vue from a CDN, no "build step" is involved. This makes the setup much more straightforward and is suitable for enhancing static HTML or integrating with a backend framework.
Vue Tip: Defining and Registering Vue Web Components Image

Vue Tip: Defining and Registering Vue Web Components

Web Components is an umbrella term for a set of web native APIs that allows developers to create reusable custom elements. Vue has excellent support for both consuming and creating custom elements.
Vue Tip: Expose Properties in a Script Setup Component Image

Vue Tip: Expose Properties in a Script Setup Component

Components using script setup are closed by default and will not expose any of the bindings declared inside script setup.
Vue Tip: Expose Slots From a Child Component  Image

Vue Tip: Expose Slots From a Child Component

Third-party components are often wrapped in a custom component. But in that way, the slots of the third-party component get lost.
Vue Tip: Typing Template Refs With TypeScript Image

Vue Tip: Typing Template Refs With TypeScript

Template refs only exist after the component is mounted. Thus, it’s necessary to type template refs with a union type that includes the DOM element type as well as null.
Vue Tip: Creating a Custom Directive Image

Vue Tip: Creating a Custom Directive

In addition to the default set of directives like v-model or v-show, you can also register your own custom directives.
Vue Tip: Avoid Directly DOM Manipulation Image

Vue Tip: Avoid Directly DOM Manipulation

It is a no-go to manipulate the DOM in Vue.js directly. Instead, you should use the "ref" attribute.
Vue Tip: Use Vue App Instance as Global Store Image

Vue Tip: Use Vue App Instance as Global Store

Vue provides an object that can be used to register global properties that can be accessed on any component instance inside the application.
Vue Tip: When to Use v-if Image

Vue Tip: When to Use v-if

v-if has higher toggle costs while v-show has higher initial render costs.