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

24 lines
562 B
JavaScript
Raw Permalink 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}`;
2021-04-06 11:46:38 +00:00
if (this.isPreview)
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);