- 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.
推薦閱讀
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第二版)
- Google Flutter Mobile Development Quick Start Guide
- Learn Blockchain Programming with JavaScript
- CMDB分步構(gòu)建指南
- Python爬蟲(chóng)開(kāi)發(fā):從入門(mén)到實(shí)戰(zhàn)(微課版)
- 趣學(xué)Python算法100例
- PHP+MySQL+Dreamweaver動(dòng)態(tài)網(wǎng)站開(kāi)發(fā)實(shí)例教程
- 數(shù)據(jù)結(jié)構(gòu)案例教程(C/C++版)
- Mastering Embedded Linux Programming
- 會(huì)當(dāng)凌絕頂:Java開(kāi)發(fā)修行實(shí)錄
- Developing Java Applications with Spring and Spring Boot
- Zend Framework 2 Cookbook
- ASP.NET jQuery Cookbook(Second Edition)
- Java EE 程序設(shè)計(jì)
- Game Programming using Qt 5 Beginner's Guide