<script>
var _mytpl = (function(){
    var _verson = 1.0;
    return {
        _data:{},
        load:function(html,data){
            with(this){
                _data.html = html;
                _data.data = data;
            }
            return this;
        },
        exec:function(){
            var me = this , t = me._data.html;
            t = t.replace(/\{(\w)+\}/g,function(arg1, arg2){
                return me._data.data[arg2];
            });
            this._data.html = t;
            t = null;
            return this;
        },
        preview:function(){
            alert(this._data.html);
        }
    };
})();
var Insa =  _mytpl.load('<div>{a}+{b}</div>', {a:1,b:2}).exec().preview();
</script>

 

相关文章:

  • 2021-10-21
  • 2022-02-08
  • 2021-10-26
  • 2021-06-14
  • 2022-02-18
  • 2021-12-17
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-12-02
  • 2021-06-17
相关资源
相似解决方案