書名: Vue.js 2 Web Development Projects作者名: Guillaume Chau本章字數: 63字更新時間: 2021-07-02 22:34:26
Initializing directly in the data
The other way is to initialize the content data property with the restored value directly:
new Vue({ // ... data () { return { content: localStorage.getItem('content') || 'You can write in **markdown**', } }, // ... })
With the preceding code, the watcher handler will not be called because we initialize the content value instead of changing it.
推薦閱讀
- Instant Node Package Manager
- Qt 5 and OpenCV 4 Computer Vision Projects
- ServiceNow Application Development
- Python 深度學習
- 青少年美育趣味課堂:XMind思維導圖制作
- Internet of Things with Intel Galileo
- Flash CS6中文版應用教程(第三版)
- Python應用輕松入門
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- Python編程從0到1(視頻教學版)
- Android開發案例教程與項目實戰(在線實驗+在線自測)
- 51單片機C語言開發教程
- 深入淺出React和Redux
- R數據科學實戰:工具詳解與案例分析
- 工業機器人離線編程