【问题标题】:How to load json data with jade?如何用jade加载json数据?
【发布时间】:2016-09-12 08:52:16
【问题描述】:

我读到了一种在jade中实现json数据的方法,代码如下:h1 = t('pages.index.headline') 但它不起作用。我得到的只是这一行作为普通文本,或者如果我写“h1 = t(...”而不是“h1 = t(...”),我的预编译器 (Prepros) 会说“t 不是函数”。

【问题讨论】:

    标签: javascript html json pug


    【解决方案1】:

    前段时间同样的事情让我很挣扎,这篇文章对我帮助很大:

    multilingual jade templates

    【讨论】:

    • 顺便说一句。几天前我还发现了语法 h1= t('pages.index.headline)。你知道怎么用吗?如果我实现这种语法,我的预编译器只会说“t 不是函数”。
    • 你确定是“t”吗?看看这个页面,它对我使用 vars 和其他符号也有很大帮助。 naltatis.github.io/jade-syntax-docs/#variables
    • 哇,看起来不错,你。是的,它的 = t() 结构是:json 文件 page { index { title: "hello" } } 和玉:h1.className= t('pages.index.title')
    • 我用t函数找到的版本的解决方案是基于i18next节点包。很有用,看看吧。
    猜你喜欢
    • 2015-10-18
    • 1970-01-01
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-20
    相关资源
    最近更新 更多