Home > Blockchain >  variable failed to print for text in vue?
variable failed to print for text in vue?

Time:12-06

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>

CodePudding user response:

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>

CodePudding user response:

You can use only one tag in root component.

  • Related