当我在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 (将#修改为@)