- 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.
- 多媒體CAI課件設計與制作導論(第二版)
- Java應用與實戰(zhàn)
- 深入淺出Prometheus:原理、應用、源碼與拓展詳解
- AIRAndroid應用開發(fā)實戰(zhàn)
- HTML5游戲開發(fā)案例教程
- SQL Server 2016數(shù)據(jù)庫應用與開發(fā)習題解答與上機指導
- Python算法從菜鳥到達人
- Django Design Patterns and Best Practices
- 金融商業(yè)數(shù)據(jù)分析:基于Python和SAS
- Web前端測試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實踐
- 大話程序員:從入門到優(yōu)秀全攻略
- 趣味掌控板編程
- 谷歌JAX深度學習從零開始學
- R for Data Science Cookbook
- C#多線程編程實戰(zhàn)