【发布时间】:2015-06-02 01:33:25
【问题描述】:
我有一个玉模板,我想将一个变量作为脚本 src 传递,因为在不同的路线上脚本会改变。我如何在 Jade and Express 中做到这一点?
doctype html
html
body
#app!= html
script(src={bundle})
在脚本 src 中传入我想要的 bundle 变量
var html = React.renderToString(node)
var bundle = '/public/js/bundle.js'
res.render('layout', { html: html, bundle: bundle })
【问题讨论】:
标签: javascript node.js express pug