微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当我在Pug模板中添加AMP字符时,为什么要重新渲染应用程序 app.ts index.pug

如何解决当我在Pug模板中添加AMP字符时,为什么要重新渲染应用程序 app.ts index.pug

我正在运行NodeJS Express应用程序,将amp字符添加到哈巴狗模板时,它会重新渲染3次或更多,我的结构是:

app.ts

import express from 'express';

const app = express();
app.set('view engine','pug');

app.get('/',function (req,res) {
  console.log('Render index');

  res.render('index',{ title: 'hey',message: 'Hello there!' })
})

index.pug

doctype html
html(amp)
  head
    title= title
  body
    h1= message

我的哈巴狗模板具有amp(已经尝试⚡字符),它显示路由器/的日志3次或更多次,但是如果我删除amp,日志仅显示1。

所以,我的问题是:为什么当Pug模板具有amp字符时它会重新渲染3次或更多?

如何将amp字符添加到帕格模板中以正确的方式使其不重新呈现。

AMP的结果

enter image description here

没有AMP的结果

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。