【问题标题】:Error in typing the paragraph in the "Snippet"在“片段”中键入段落时出错
【发布时间】:2021-09-03 00:09:09
【问题描述】:

我是初学者 Dev。我正在使用 ejs 开发代码,但是在编辑“sn-p”中的段落时出现错误。我打破了段落不要太长,但这样做时出错了。

请有人帮助我!

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})
})

【问题讨论】:

    标签: javascript node.js ejs


    【解决方案1】:

    你应该使用反引号`,它被称为模板字符串,它支持多行。

    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(),
        }
    ]
    

    【讨论】:

      猜你喜欢
      • 2016-12-14
      • 2020-04-15
      • 1970-01-01
      • 2011-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多