SOURCE

var Class = {
    extend:function({initialize,members,protos}){ 
           
            var _this = this;
            var newClass = function(options){

                //静态成员
                var members = members || {};
                for(var i in members){
                    this[i] = members[i];
                }
                //实例化时的参数对象也并到实例成员中
                var options = options||{};
                if(Object.prototype.toString.call(options) === '[object Object]'){
                    for(var i in options){
                        if(this[i] && Object.prototype.toString.call(this[i]) === '[object Object]'){
                            this[i] = {
                                ...this[i],
                                ...options[i]
                            }
                        }else{
                            this[i] = options[i];   
                        }
                    }
                }
               

                //执行初始化方法
                initialize && initialize.call(this);


                // this.extend = _this.extend;
            }
            newClass.extend = _this.extend

            //原型继承
            newClass.prototype = {
                ..._this.prototype,
                ...protos||{}
            };
            return newClass; 
    },
    prototype:{
        class_f:function(){

        }
    }
}

var A = Class.extend({
    members:{

    },
    initialize:function(){ 
       this.__proto__.dom = 456
    },
    protos:{ 
       a_f:function(){
           console.log('a_f');
       }
    }
})

var B = A.extend({
    members:{
        b_attr:{
            a:1
        }
    },
    initialize:function(){

    },
    // protos:{
    //     a_f:function(){ 
    //         console.log('b_f')
    //     }
    // }
})

var b = new B({
  b_attr:{
      b:2
  }
});
console.log(b);
console.log(b.a_f())
//console.log(new B())
console 命令行工具 X clear

                    
>
console