在 "Snippet" 中键入段落时出错
Error in typing the paragraph in the "Snippet"
我是初级开发者。我正在使用 ejs 开发代码,但是在编辑“片段”中的段落时出现错误。我把段落打断了,以免太长,但这样做时出错了。
请有人帮助我!
app.set('view engine','ejs')
app.get('/', (req,res)=>{
const blogs =[
{
title: 'Thomas Sankara (Burkina Faso)',
snippet: 'Earlier this month a court in Burkina Faso's capital
indicted former President Blaise Compaoré for his role
in the murder of his comrade, Thomas Sankara on 15 October 1987.',
author: 'Jocelyne Botshimbo M pusa',
createdAt: Date.now(),
}
]
res.render('index',{blogs: blogs})
})
你应该使用反引号`
,它被称为模板字符串,它支持多行。
const blogs = [
{
title: 'Thomas Sankara (Burkina Faso)',
snippet: `Earlier this month a court in Burkina Faso's capital
indicted former President Blaise Compaoré for his role
in the murder of his comrade, Thomas Sankara on 15 October 1987.`,
author: 'Jocelyne Botshimbo M pusa',
createdAt: Date.now(),
}
]
我是初级开发者。我正在使用 ejs 开发代码,但是在编辑“片段”中的段落时出现错误。我把段落打断了,以免太长,但这样做时出错了。
请有人帮助我!
app.set('view engine','ejs')
app.get('/', (req,res)=>{
const blogs =[
{
title: 'Thomas Sankara (Burkina Faso)',
snippet: 'Earlier this month a court in Burkina Faso's capital
indicted former President Blaise Compaoré for his role
in the murder of his comrade, Thomas Sankara on 15 October 1987.',
author: 'Jocelyne Botshimbo M pusa',
createdAt: Date.now(),
}
]
res.render('index',{blogs: blogs})
})
你应该使用反引号`
,它被称为模板字符串,它支持多行。
const blogs = [
{
title: 'Thomas Sankara (Burkina Faso)',
snippet: `Earlier this month a court in Burkina Faso's capital
indicted former President Blaise Compaoré for his role
in the murder of his comrade, Thomas Sankara on 15 October 1987.`,
author: 'Jocelyne Botshimbo M pusa',
createdAt: Date.now(),
}
]