官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 五台县| 彰化县| 贵溪市| 安陆市| 温州市| 宁城县| 武山县| 英吉沙县| 城固县| 微山县| 乌什县| 龙山县| 托里县| 新乡市| 垣曲县| 红原县| 城步| 萨嘎县| 宁化县| 大关县| 正镶白旗| 赤壁市| 远安县| 翁源县| 邹平县| 河源市| 华安县| 栾城县| 阳泉市| 额尔古纳市| 古蔺县| 乌兰察布市| 舒城县| 仙桃市| 汉沽区| 玉溪市| 达孜县| 罗江县| 五大连池市| 正蓝旗| 丰都县|