- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 61字
- 2021-07-02 19:57:24
Removing listener
To avoid any memory leaks, we should also useremoveEventListenerto get rid of the listener when the Vue instance is torn down. We can use thedestroyhook and call ourescapeKeyListenermethod for this purpose.
app.js:
new Vue({ data: { ... }, methods: { ... }, watch: { ... }, created: function() { ... }, destroyed: function () { document.removeEventListener('keyup', this.escapeKeyListener); } });
推薦閱讀
- ServiceNow Application Development
- Google Apps Script for Beginners
- Python從小白到大牛
- Visual FoxPro 程序設計
- Flink SQL與DataStream入門、進階與實戰
- Cassandra Design Patterns(Second Edition)
- Java程序員面試算法寶典
- Hands-On Natural Language Processing with Python
- Mastering JavaScript Design Patterns(Second Edition)
- 計算機應用基礎教程(Windows 7+Office 2010)
- Moodle 3 Administration(Third Edition)
- Android Sensor Programming By Example
- Apache Solr PHP Integration
- INSTANT LESS CSS Preprocessor How-to
- 可視化H5頁面設計與制作:Mugeda標準教程