In this tutorial, you’ll learn how to concatenate/chain variable and text in Vue.js.
You’ll come across to the situations when you need to, e.g. create an image path by combining a static URL and a string in HTML template, very often.
Let’s build this example:
<img :src="staticUrl + 'img/logo.png'">
staticUrl is wrapped in the double quotation marks, whereas the image name is wrapped in both double and single quotation makes.
Now, let’s create a “share this page” variable that will contain a link to the page and some generic text.
this.shareText = 'I’ve found this great article ' + article.permalink
If you find this post useful, please let me know in the comments below.
Want to share this with your friends?