Use computed prop for device name in location popup

This commit is contained in:
Linus Groh
2020-01-25 23:33:10 +00:00
parent 988b10de40
commit 6cbdf30580
+10 -3
View File
@@ -1,7 +1,6 @@
<template>
<LPopup>
<div v-if="name" class="device">{{ name }}</div>
<div v-else class="device">{{ user }}/{{ device }}</div>
<div class="device">{{ deviceName }}</div>
<div class="wrapper">
<img v-if="face" :src="faceImageDataURI" alt="" />
<ul class="info-list">
@@ -122,13 +121,21 @@ export default {
},
computed: {
/**
* Return the face image as a data URI string which can be used for an image's src attribute
* Return the face image as a data URI string which can be used for an image's src attribute.
*
* @return {String} base64-encoded face image data URI
*/
faceImageDataURI() {
return `data:image/png;base64,${this.face}`;
},
/**
* Return the device name for displaying with <user identifier>/<device identifier> as fallback.
*
* @return {String} device name for displaying
*/
deviceName() {
return this.name ? this.name : `${this.user}/${this.device}`;
},
},
};
</script>