Home  >  Article  >  Web Front-end  >  How to implement variable and string concatenation in vue

How to implement variable and string concatenation in vue

陈政宽~
陈政宽~Original
2018-05-24 10:02:564904browse

This article mainly introduces how to realize the splicing of variables and string in vue. The editor thinks it is quite good. Now I will share it with you. Give everyone a reference. Let’s follow the editor to take a look.

Organize the documents, search out a code on how to implement variable and string splicing in vue, sort it out and streamline it a little for sharing.

Define variables in data:

data() {
  return {
    a: 'A'
  }
}

How to splice string and variable a by clicking on

button ?

<button @click=&#39;showMsg&#39;></button>
//vue
methods: {
  showMsg() {
    alert(`获取了${a}`);
  }
}

Note that there are not single quotes in alert(), but two ` signs (keys below esc).

Click the button to appear


The above is the entire content of this article. I hope it will be helpful to everyone’s study. I also hope that everyone will support the script. Home.

The above is the detailed content of How to implement variable and string concatenation in vue. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn