- 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.
推薦閱讀
- Qt 5 and OpenCV 4 Computer Vision Projects
- Kubernetes實(shí)戰(zhàn)
- OpenCV實(shí)例精解
- Instant 960 Grid System
- Designing Hyper-V Solutions
- Mastering Ubuntu Server
- 征服RIA
- Java性能權(quán)威指南(第2版)
- 基于Swift語(yǔ)言的iOS App 商業(yè)實(shí)戰(zhàn)教程
- SQL經(jīng)典實(shí)例(第2版)
- jQuery炫酷應(yīng)用實(shí)例集錦
- C++反匯編與逆向分析技術(shù)揭秘(第2版)
- Learning Docker Networking
- Java Web應(yīng)用開(kāi)發(fā)給力起飛
- Java并發(fā)編程:核心方法與框架