I am currently working on creating error messages with notifications in Vue.js.
If you would like to see a tutorial demo, please visit:
You can also check out the tutorial codes here: https://github.com/vue-bulma/vue-admin/blob/master/client/views/components/Notification.vue
openNotificationWithType: function (type) {
openNotification({
title: 'Error',
message: 'Hello\nWorld',
type: type
})
}
In the code snippet above, when I use \n in a string, it does not render as a linefeed.
I have been searching for ways to apply linefeeds in JS, but haven't found a definitive answer yet.
I have tried several options:
1)
message: `Hello
World`
2)
message: 'Hello' +
'' + 'World'
3)
message: 'Hello'
+ 'World'
4)
message: 'Hello' + '\n' + 'World'
5)
message: 'Hello<br/>World'
6)
message: 'Hello<br>World'
7)
message: `Hello \
World`
8)
message: [`Hello`,
`World`].join(' ')
Here are the results of my experiments: results of error message
* Please note that I am using Mac OS.