2 <article v-if="show" class="message" :class="message.style">
3 <div v-if="message.title || message.icon" class="message-header">
5 <i v-if="message.icon" :class="`fa-fw ${message.icon}`"></i>
10 v-if="message.content"
12 v-html="message.content"
29 created: async function () {
30 // Look for a new message if an endpoint is provided.
31 this.message = Object.assign({}, this.item);
32 if (this.item && this.item.url) {
33 const fetchedMessage = await this.getMessage(this.item.url);
34 // keep the original config value if no value is provided by the endpoint
35 for (const prop of ["title", "style", "content"]) {
36 if (prop in fetchedMessage && fetchedMessage[prop] !== null) {
37 this.message[prop] = fetchedMessage[prop];
41 this.show = this.message.title || this.message.content;
44 getMessage: function (url) {
45 return fetch(url).then(function (response) {
46 if (response.status != 200) {
49 return response.json();