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

24 lines
573 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/${this.$options.name}/assets/images/${image}`;
return src;
},
getReportSrc(image) {
const assetsPath = `${config.app.host}/api/${this.$options.name}`;
const imagePath = `${assetsPath}/assets/images/${image}`;
return imagePath;
}
}
};
Vue.mixin(imageSrc);