node.js - express采用jade模板,在iframe便签里src里的地址可以是.jade后缀吗
怪我咯
怪我咯 2017-04-17 13:57:54
0
2
581

express采用jade模板,在iframe便签里src里的地址可以是.jade后缀吗?
如果我想把动态的html内容渲染到这个src里,而不是单独的给他传一个地址,应该怎么做?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
左手右手慢动作

I guess you didn’t understand what I said last time. The iframe in src must be an accessible url, regardless of whether it is a jade template engine on the server side.

Since you are using express, wouldn’t you just write a route for this url?

//假设这里的xxx/yyy就是你上一个页面的iframe里填的src
app.get('/xxx/yyy', function (req, res) {
  //因为iframe里自己又访问了这个url,然后又到了路由这里,那下面的数据对象,当然可以是动态的啊?
  res.render('index', { title: 'Hey', message: 'Hello there!'});
});

I suggest you first understand iframe what is going on. If you just ask "can iframe be dynamic", it is probably difficult for others to answer. Come, let’s look at the document iframe

刘奇

Set routing and define variables

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template