Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
variable failed to print for text in vue?

I'm using a library but I got Close {{myVar}} printed on the screen. How do I use template literal in vue? I'm coming from react jsx background.

<template>
  <a-alert message="Info Text" type="info" close-text="Close {{myVar}}" />
   {{myVar}} /* it works here */
</template>
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

In vue, you can use variate like this:

<template>
    <a-alert message="Info Text" type="info" :close-text="myVar" />
        {{myVar}} /* it works here */
</template>

// combine with other text
<template>
    <a-alert message="Info Text" type="info" :close-text="`Close ${myVar}`" />
        {{myVar}} /* it works here */
</template>
about 4 years ago · Juan Pablo Isaza Report

0

In your code you're passing prop close-text as text. For passing values other than text you need to put : as prefix, like :prop="value".

More info about this: https://vuejs.org/v2/guide/components-props.html

Solution for your problem would be:

<template>
  <a-alert message="Info Text" type="info" :close-text="`Close ${myVar}`" />
   {{myVar}} /* it works here */
</template>
about 4 years ago · Juan Pablo Isaza Report

0

You can use only one tag in root component.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!