vue2.0 代码功能片段

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'));

 

 

 
posted @ 2017-05-05 11:38  Lonely,lonelyBurning  阅读(846)  评论(0编辑  收藏  举报