js面向对象写法
电脑版发表于:2019/4/2 20:15
方法1:
var cq = function() { this.init = function() { this.event(); } this.create = function() { $('#child').html("<Ul><LI id='f'>a</LI> <LI id ='th'>b</LI> <LI id = 't'>c</LI></Ul>"); } this.event = function() { var t = this; $('#cq').bind('click', function() { t.create()//要调用本对象方法要在上边记录下this ); } }
方法2:
var zxprice = {}; zxprice.qyportChoise = function (_qyporten) { }