- Vue.js 2 Web Development Projects
- Guillaume Chau
- 216字
- 2021-07-02 22:34:24
Displaying text
The first template feature we will see is the text interpolation, which is used to display dynamic text inside our web page. The text interpolation syntax is a pair of double curly braces containing a JavaScript expression of any kind. Its result will replace the interpolation when Vue will process the template. Replace the <p id="root"> element with the following:
<p id="root">
<p>{{ message }}</p>
</p>
The template in this example has a <p> element whose content is the result of the message JavaScript expression. It will return the value of the message attribute of our instance. You should now have a new text displayed on your web page--Hello Vue.js!. It doesn't seem like much, but Vue has done a lot of work for us here--we now have the DOM wired with our data.
To demonstrate this, open your browser console and change the app.message value and press Enter on the keyboard:
app.message = 'Awesome!'
The message has changed. This is called data-binding. It means that Vue is able to automatically update the DOM whenever your data changes without requiring anything from your part. The library includes a very powerful and efficient reactivity system that keeps track of all your data and is able to update what's needed when something changes. All of this is very fast indeed.
- C及C++程序設(shè)計(jì)(第4版)
- Mastering AWS Lambda
- Visual C++程序設(shè)計(jì)學(xué)習(xí)筆記
- JavaScript:Functional Programming for JavaScript Developers
- Android開發(fā)精要
- React.js Essentials
- 人人都是網(wǎng)站分析師:從分析師的視角理解網(wǎng)站和解讀數(shù)據(jù)
- Lighttpd源碼分析
- Internet of Things with ESP8266
- 軟件體系結(jié)構(gòu)
- 數(shù)字媒體技術(shù)概論
- 例解Python:Python編程快速入門踐行指南
- CryENGINE Game Programming with C++,C#,and Lua
- 數(shù)據(jù)結(jié)構(gòu)與算法詳解
- Mastering Magento Theme Design