vue2.0 代碼功能片段
阿新 • • 發佈:2017-05-05
vue lag taf 數組 select 括號 light oar brush
1、代碼片段截取
checkAll: function(flag){ this.checkAllFlag = flag; this.productList.forEach(function(value,index){ value.checked = flag; }) this.calcTotalPrice(); },
2、es6語法,解構賦值
const {shell} = require(‘electron’);大括號什麽意思
3、本地存取;
/** * 向localStorage中設置數據 * @param key 字符串 * @param value 數組 */ function SetDataIntoLocalStorage(key, value) { localStorage.setItem(key, JSON.stringify(value)); }; /** * 從localStorage中獲取數據 * @param key 字符串 */ function GetDataFromLocalStorage(key) { return JSON.parse(localStorage.getItem(key)); } $timeout(function(){ //ipcRenderer.send(‘settingsWindowInitFinished‘); }); }]);
4、比較函數
sort(function(a,b){ return a -b ; })
5、Electron clipboard 模塊
Electron clipboard 模塊 clipboard 模塊提供方法來供復制和粘貼操作 . 下面例子展示了如何將一個字符串寫道 clipboard 上: const clipboard = require(‘electron‘).clipboard; clipboard.writeText(‘Example String‘); 在 X Window 系統上, 有一個可選的 clipboard. 你可以為每個方法使用 selection 來控制它: clipboard.writeText(‘Example String‘, ‘selection‘); console.log(clipboard.readText(‘selection‘));
vue2.0 代碼功能片段