var Test = function(data){ this.data = data}Test.prototype = { initHtml: function(){ var html = '<div class="test">'+ this.data +'</div>' return html }, create: function(){ $('body').append(this.initHtml()) this.initEvent() }}頁面中很多類似的構(gòu)造函數(shù)Test1,Test2...在頁面中通過new Test1('我是內(nèi)容'),new Test2('我是內(nèi)容')生成內(nèi)容請(qǐng)問大家如何修改構(gòu)造函數(shù)或者其他方法可以做到new Test1('其他內(nèi)容')的時(shí)候?qū)?yīng)修改原來new Test1('我是內(nèi)容')生成在頁面中的內(nèi)容單例模式???
實(shí)例化構(gòu)造函數(shù)無刷新改變內(nèi)容??
森林海
2018-11-08 13:19:54