zoukankan      html  css  js  c++  java
  • model.js

    var Model = {

    inherited: function  () {},
    
    created: function () {},
    
    prototype: {
    	init: function (attrs){
    		if(attrs){
    			this.load(attrs);
    		}
    	},
    
    	load: function  (attrs) {
    		for(var name in attrs){
    			this[name] = attrs[name];
    		}
    	}
    },
    
    create: function (){
    	var object = Object.create(this);
    	object.parent = this;
    	object.prototype = object.fn = Object.create(this.prototype);
    
    	object.created();
    	this.inherited(object);
    	return object;
    },
    
    init: function(){
    	var instance = Object.create(this.prototype);
    	instance.parent = this;
    	instance.init.apply(instance, arguments);
    	return instance;
    },
    
    find: function  () {
    	
    },
    
    extend: function  (o) {
    	var extended = o.extended;
    	
    }
    

    }

    var Asset = Model.create();
    var User = Model.create();

    var user = User.init();

  • 相关阅读:
    十天冲刺4
    单词统计
    十天冲刺3
    学习进度第十周
    十天冲刺2
    十天冲刺1
    梦断代码阅读笔记03
    学习进度第九周
    [强网杯 2019]Upload
    [2020 新春红包题]1
  • 原文地址:https://www.cnblogs.com/lanse-yan/p/3977701.html
Copyright © 2011-2022 走看看