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

24 lines
573 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/${this.$options.name}/assets/images/${image}`;
2019-10-29 06:46:44 +00:00
return src;
2019-10-31 11:43:04 +00:00
},
getReportSrc(image) {
const assetsPath = `${config.app.host}/api/${this.$options.name}`;
const imagePath = `${assetsPath}/assets/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
}
}
2019-10-29 06:46:44 +00:00
};
Vue.mixin(imageSrc);