salix/print/core/mixins/image-src.js

25 lines
575 B
JavaScript

const Vue = require('vue');
const config = require('../config');
const imageSrc = {
methods: {
getEmailSrc(image) {
let src = `cid:${image}`;
if (this.isPreview === 'true')
src = `/api/assets/${this.$options.name}/images/${image}`;
return src;
},
getReportSrc(image) {
const assetsPath = `${config.app.host}/api/assets`;
const imagePath = `${assetsPath}/${this.$options.name}/images/${image}`;
return imagePath;
}
},
};
Vue.mixin(imageSrc);