Home > Article > Web Front-end > How to implement variable and string concatenation in vue
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='showMsg'></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 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!