Home > Web Front-end > Vue.js > body text

How to splice strings in vue.js

coldplay.xixi
Release: 2020-11-30 16:13:53
Original
4858 people have browsed it

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 [].

How to splice strings in vue.js

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

Concatenate strings and variables a by clicking buttons

<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 (esc button below).

Click the button to appear

How to splice strings in vue.js

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!