2 <article v-if="show" class="message" :class="message.style">
3 <div v-if="message.title" class="message-header">
4 <p>{{ message.title }}</p>
6 <div v-if="message.content" class="message-body" v-html="message.content"></div>
22 created: async function () {
23 // Look for a new message if an endpoint is provided.
24 this.message = Object.assign({}, this.item);
25 if (this.item && this.item.url) {
26 const fetchedMessage = await this.getMessage(this.item.url);
27 // keep the original config value if no value is provided by the endpoint
28 for (const prop of ["title", "style", "content"]) {
29 if (prop in fetchedMessage && fetchedMessage[prop] !== null) {
30 this.message[prop] = fetchedMessage[prop];
34 this.show = this.message.title || this.message.content;
37 getMessage: function (url) {
38 return fetch(url).then(function (response) {
39 if (response.status != 200) {
42 return response.json();