\ n不在警报打字稿中工作

时间:2018-03-08 02:04:53

标签: javascript typescript ionic-framework ionic2

为什么换行符不能用于警报打字稿?我已经尝试了\\ n,\ r \ n,\ n但是它不起作用我的代码我想要换行,

   else if(isVerified == true && localStorage.getItem("verified") == "false"){

  this.alert.create({
    title: "You are almost there! ",
    message: "As of the moment you can only \n receive items (Receiver) from other users of PlsDala. \n To Add a travel plan and deliver items (Courier) , and \n avail a delivery service (Receiver)." +"\r\n" + "Please prepare: \n\n\n One (1) valid ID \n\n One (1)  copy of your Birth Certificate \n Two (2) latest copy of your 2x2 picture \n For your personal interview at this Address: \n You can call this number () for more details",
    inputs: [{
      type: 'checkbox',
      label: 'Don\'t show this again',
      handler: data=>{
        localStorage.setItem("verified", ""+data.checked+"");
      }
    }], 
    buttons: [{
      text: "Ok",
      role: 'cancel',
    }]
  }).present();
}

}

2 个答案:

答案 0 :(得分:0)

您可以在提醒的消息字段中使用html语法,尝试使用< br />而不是换行符。

答案 1 :(得分:0)

  

取决于您显示提醒的位置。它不是打字稿错误   因为打字错误不是由打字稿完成的。你必须   根据您显示的位置使用换行符   警报。

\n适用于Linux控制台。但是,如果您在网页中显示它,请使用相应的换行符,即<br/>