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

How to implement variable and string concatenation in vue

陈政宽~
Release: 2018-05-24 10:02:56
Original
4973 people have browsed it

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'
  }
}
Copy after login

How to splice string and variable a by clicking on

button ?

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template