module.exports = { name: 'attachment', computed: { attachmentPath() { const filename = this.attachment.filename; const component = this.attachment.component; if (this.attachment.cid && component) return `/api/${component}/assets/files/${filename}`; else if (this.attachment.path) return `/api/${this.attachment.path}?${this.getHttpParams()}`; } }, methods: { getHttpParams() { const props = this.args; let query = ''; for (let param in props) { if (props[param] && !(props[param] instanceof Object)) { if (query != '') query += '&'; query += `${param}=${props[param]}`; } } return query; } }, props: { attachment: { type: Object, required: true }, args: { type: Object, required: false } } };