将变量传递给html href

时间:2020-03-18 18:24:46

标签: javascript html sendgrid

在将env变量传递给html href值时遇到问题。

我使用的是一个工作示例,该示例是通过电子邮件收到的消息。从本质上讲,这是我要追求的目标,但是我试图在http://localhost:4200/wins所在的位置插入环境变量

const msg = {
  to: notificationResults[0].email,
  from: 'myapp@DONOTREPLY.com',
  subject: 'You\'ve won! Woohoo!',
  html: '<a href="http://localhost:4200/wins' +
    payload.id +
    "/" +
    token +
    '">Please visit your My Wins page to complete payment.</a>'
};

我尝试添加env变量

const msg = {
    to: notificationResults[0].email,
    from: 'myapp@DONOTREPLY.com',
    subject: 'You\'ve won! Woohoo!',
    html: '<a href="'process.env.WEBSITE_URL + "/wins" +
    '">Please visit your My Wins page to complete payment.</a>'
    };

但是在process.上有错误

',' expected.ts(1005)

我在做什么错?感谢您的帮助!

0 个答案:

没有答案
相关问题