• 请不要在回答技术问题时复制粘贴 AI 生成的内容
gaody
V2EX  ›  程序员

一想到要将json拼凑成又长又复杂的html我就窝火

  •  
  •   gaody · Jun 9, 2013 · 5917 views
    This topic created in 4725 days ago, the information mentioned may be changed or developed.
    搜索了一下有个jquery tmpl插件可是似乎不再支持了

    有不想用js 拼凑字符串

    有什么好方法吗?
    25 replies    1970-01-01 08:00:00 +08:00
    likexian
        1
    likexian  
       Jun 9, 2013   ❤️ 1
    jerry
        2
    jerry  
       Jun 9, 2013 via iPad   ❤️ 1
    refresh
        3
    refresh  
       Jun 9, 2013
    还有handlebars等等一堆的模板引擎,或者用jQuery与underscore的template
    gDD
        4
    gDD  
       Jun 9, 2013 via Android   ❤️ 1
    doT.js很不错!
    maddot
        5
    maddot  
       Jun 9, 2013
    在服务器端生成html片段也是一个方法吧
    lyric
        6
    lyric  
       Jun 9, 2013   ❤️ 3
    这种时候不推荐 http://angularjs.org/ 是不科学的。这才是最好的模版。
    explon
        7
    explon  
       Jun 9, 2013 via iPhone   ❤️ 1
    hogan
    greatghoul
        8
    greatghoul  
       Jun 9, 2013
    mustache +1
    coffee +1
    angularjs +1
    fiture
        9
    fiture  
       Jun 9, 2013
    你不知道有模板么?
    fiture
        10
    fiture  
       Jun 9, 2013
    @fiture 模板引擎。
    lerry
        11
    lerry  
       Jun 9, 2013
    试试这个,
    https://github.com/leonidas/transparency
    前一段在hacker news上还看到一个,想不起来名字了,应该是这个
    gaody
        12
    gaody  
    OP
       Jun 9, 2013
    @maddot 显然没有返回json节省资源,而且服务器端也要拼凑啊,当然服务器端简单点

    @jerry 在看

    @refresh jquery的template 不支持了吧

    @gDD doT.js好像很直观的样子
    unstop
        13
    unstop  
       Jun 9, 2013
    @lerry 别用这个,我之前在项目里面用过这个,很难用,很难维护,最后不得不换,现在切换成了 http://aui.github.io/artTemplate/ 还算可以。
    Paranoid
        14
    Paranoid  
       Jun 9, 2013
    AngularJS 服务端json, 客户端数据绑定,自动更新template。
    Sivan
        15
    Sivan  
       Jun 10, 2013
    handlebars.js
    zhujinliang
        16
    zhujinliang  
       Jun 10, 2013
    我们这的哥们一行一行document.write都写了,楼主这算啥。。。
    catfan
        17
    catfan  
       Jun 10, 2013
    alexrezit
        18
    alexrezit  
       Jun 10, 2013
    @lyric
    看你越来越像搞传销的了... =.=
    lyric
        19
    lyric  
       Jun 10, 2013
    @alexrezit 看错了不是,我这不符合传销的性质,而且其实本质上传销没啥不好的
    magic22cn
        20
    magic22cn  
       Jun 11, 2013
    js模板怎么应对搜索引擎?
    ehaagwlke
        21
    ehaagwlke  
       Jun 12, 2013
    用AngularJS吧,再好用不过了。
    xiangheka
        22
    xiangheka  
       Jun 12, 2013
    jqote2 和jtemplate类似
    raptor
        23
    raptor  
       Jun 13, 2013
    jquery的template好像已经被废了。我只用underscore,貌似还可以。
    juicy
        24
    juicy  
       Jun 13, 2013
    jquery的template只是不再在官网推荐了吧,github上还是有那个项目的,想用还是可以用的~~
    jackhe
        25
    jackhe  
       Jun 13, 2013
    jsrender
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   846 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 72ms · UTC 21:16 · PVG 05:16 · LAX 14:16 · JFK 17:16
    ♥ Do have faith in what you're doing.