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

25 lines
575 B
JavaScript
Raw Normal View History

2019-10-29 06:46:44 +00:00
const Vue = require('vue');
2019-10-31 11:43:04 +00:00
const config = require('../config');
2019-10-29 06:46:44 +00:00
const imageSrc = {
methods: {
2019-10-31 11:43:04 +00:00
getEmailSrc(image) {
2019-10-29 06:46:44 +00:00
let src = `cid:${image}`;
if (this.isPreview === 'true')
src = `/api/assets/${this.$options.name}/images/${image}`;
return src;
2019-10-31 11:43:04 +00:00
},
getReportSrc(image) {
const assetsPath = `${config.app.host}/api/assets`;
const imagePath = `${assetsPath}/${this.$options.name}/images/${image}`;
2019-11-04 07:54:21 +00:00
2019-10-31 11:43:04 +00:00
return imagePath;
2019-10-29 06:46:44 +00:00
}
},
};
Vue.mixin(imageSrc);