0

I was trying to understand a Vue code when I saw something like this

  <q-field
      v-if="isEditing"
      :label="to.label"
      :helper="helper"

Can someone explain me what does this:label="to.label" mean in VueJS

4 Answers 4

3

If you want to bind any dynamic behaviour, we need to use 'v-' prefix. in shorthand we can use ':'

full syntax v-bind:href="url"

shorthand :href="url"

refer: https://v2.vuejs.org/v2/guide/syntax.html

Sign up to request clarification or add additional context in comments.

Comments

0

As is mentioned above it is equivalent to the v-bind:

May also help to mention that anything you write inside of the quotes

:label="in here" 

will be read dynamically. So for the code you were looking at to.label and helper are most likely values defined elsewhere

Comments

0

:label="to.label is equal,

  • Binding dynamic value v-bind:label="your_dynamic_value".
  • Label is a props from q-field component.

Comments

0

In vuejs documentation you can read how to bind props , here is the full explanation about this : https://v2.vuejs.org/v2/guide/components-props.html

Simply if I want to bind prop from parent component to child , I can use :name_of_prop="value_of_prop"

This ':' are short hand from v-bind :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.