V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hardman
V2EX  ›  Python

使用 js 生成模板读取 json 中的内容的时候读取不出来

  •  
  •   hardman · 2017-02-10 13:29:34 +08:00 · 1687 次点击
    这是一个创建于 2841 天前的主题,其中的信息可能已经有所发展或是发生改变。
    '#{% for items in comments %}',
    '#{% if loop.index > 2 %}',
    '#{% break %}',
    '#{% endif %}',
    '<li>',
    '<a class="_4zhc5 _iqaka" title="#{items.username}" href="/profile/#{items.user_id }"
    '#{items.username}',
    '</a>',
    '<span>',
    '<span>',
    '#{items.content}',
    '</span>',
    '</span>',
    ' </li>',
    '#{% endfor %}',
    hardman
        1
    hardman  
    OP
       2017-02-10 13:31:06 +08:00
    {
    "has_next": true,
    "images": [
    {
    "head_url": "http://images.nowcoder.com/head/710m.png",
    "comment_count": 3,
    "user_id": 100,
    "created_date": "2017-01-19 14:22:51",
    "url": "http://images.nowcoder.com/head/603m.png",
    "user_name": "User100",
    "id": 994,
    "comments": [
    {
    "username": "User100",
    "content": "This is a comment0",
    "user_id": 100
    },
    {
    "username": "User100",
    "content": "This is a comment1",
    "user_id": 100
    }
    ]
    },
    {
    "head_url": "http://images.nowcoder.com/head/710m.png",
    "comment_count": 3,
    "user_id": 100,
    "created_date": "2017-01-19 14:22:51",
    "url": "http://images.nowcoder.com/head/972m.png",
    "user_name": "User100",
    "id": 993,
    "comments": [
    {
    "username": "User100",
    "content": "This is a comment0",
    "user_id": 100
    },
    {
    "username": "User100",
    "content": "This is a comment1",
    "user_id": 100
    }
    ]
    },
    {
    "head_url": "http://images.nowcoder.com/head/710m.png",
    "comment_count": 3,
    "user_id": 100,
    "created_date": "2017-01-19 14:22:51",
    "url": "http://images.nowcoder.com/head/151m.png",
    "user_name": "User100",
    "id": 992,
    "comments": [
    {
    "username": "User100",
    "content": "This is a comment0",
    "user_id": 100
    },
    {
    "username": "User100",
    "content": "This is a comment1",
    "user_id": 100
    }
    ]
    }
    ]
    }
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1410 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:24 · PVG 01:24 · LAX 09:24 · JFK 12:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.