How to splice strings in vue.js: First define variables in data, the code is [data(){return{a: 'A'}}]; then implement strings and variables by clicking buttons The splicing of a, the code is [].
The operating environment of this tutorial: windows10, vue2.5.2, this article is applicable to all brands of computers.
【Recommended related articles:vue.js】
Method of splicing strings in vue.js:
Define variables in data:
data() { return { a: 'A' } }
Concatenate strings and variables a by clicking buttons
//vue methods: { showMsg() { alert(`获取了${a}`); } }
Note that there are not single quotes in alert(), but two ` signs (esc button below).
Click the button to appear
Related free learning recommendations:JavaScript(video)
The above is the detailed content of How to splice strings in vue.js. For more information, please follow other related articles on the PHP Chinese website!