A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://vuejs.github.io/vetur/guide/interpolation.html below:

Website Navigation


Interpolation Support | Vetur

# Interpolation Support

Vue template allows JavaScript-esque expression in four constructs:

Other than the filter syntax (opens new window), the expression is 100% JavaScript expression.

Vetur now offers completion, diagnostics, hover, jump to definition, find references for these JavaScript snippets.

# Generic Language Features

WARNING

These features are experimental and you need to set vetur.experimental.templateInterpolationService: true to enable them. You can also only disable template diagnostics with vetur.validation.interpolation: false.

Currently diagnostics, hover, jump to definition and find references are implemented in this way:

TIP

Use the command "Vetur: Show corresponding virtual file and sourcemap" to understand how the templates are represented in Vetur. Useful for bug filing too.

If you do find bugs, please fill an issue (opens new window).

If you want more details as to how this feature is implemented, I wrote a blog post: Generic Vue Template Interpolation Language Features (opens new window).

# Completion

Completion now works a little bit differently than the other language features. Mainly because completion works off a Syntactically incomplete file and the generic compiler from Vue template to virtual TypeScript file cannot handle that yet.

Completion:

# Type Checking with JSDocs

You don't have to use lang="ts" for typing functions. This would show error that 'foo' is not assignable to number

# Prop Validation

You can turn on/off this feature with vetur.validation.templateProps.

Vetur will now validate HTML templates that uses child components. For example, given two children:

Simple.vue:

Complex.vue:

Vetur will show a warning for <simple> and an error for <complex>.

The rules are:

# Prop Type Validation

You can turn on/off this feature with vetur.validation.templateProps.

Vetur will now validate that the interpolation expression you pass to child component's props match the props signature. Consider this simple case:

Child.vue:

Parent.vue:

Vetur will generate a diagnostic error on str in Parent.vue template :str="num", with a message that type 'number' is not assignable to type 'string'.

Supported:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4