js 面向对象的 原型的模式创建对象

window.onload = function(){
  var D1 = new yzzMethod();
  D1.upload('参数');
};
function yzzMethod(){
  this.status = new Object();
  console.log('初始化的时候会运行到这里');
  this.href = 'http';
};
yzzMethod.prototype.upload = function(data){
  console.log('传图方法')
  this.status['传图'] = {'name':'god','age':'18'};
  console.log(this.status['传图'].age);
  console.log(data)
  wbfun();
  console.log(this.href);
};

function wbfun(){
  console.log('外部方法');
};

posted @ 2019-12-17 10:24  幻景  阅读(162)  评论(0编辑  收藏  举报