jquery模擬生成uuid
阿新 • • 發佈:2018-12-10
var list = { bindEvent:function(){ //用於生成uuid,獲取廣告所用第一步 S4:function(){ return (((1+Math.random())*0x10000)|0).toString(16).substring(1); }, //用於生成uuid,獲取廣告所用第二步 getRandomId:function(){ var self = this; return (self.S4()+self.S4()+"-"+self.S4()+"-"+self.S4()+"-"+self.S4()+"- "+self.S4()+self.S4()+self.S4()); } }, //呼叫 getAdvert:function(){ var self = this; console.log('cms'+self.getRandomId()) } }