mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-15 02:39:12 +01:00
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
|
import {
|
||
|
require_axios
|
||
|
} from "./chunk-JDUKLXPO.js";
|
||
|
import {
|
||
|
__commonJS,
|
||
|
__require
|
||
|
} from "./chunk-7FP5O474.js";
|
||
|
|
||
|
// node_modules/vue-auth-image/vue-auth-image.js
|
||
|
var require_vue_auth_image = __commonJS({
|
||
|
"node_modules/vue-auth-image/vue-auth-image.js"(exports, module) {
|
||
|
(function() {
|
||
|
var vueAuthImage = {};
|
||
|
var axios = typeof __require === "function" ? require_axios() : window.Axios;
|
||
|
if (!axios) {
|
||
|
throw new Error("[vue-auth-image] cannot locate Axios");
|
||
|
}
|
||
|
function setImgSrc(el, binding) {
|
||
|
if (binding.oldValue === void 0 || binding.value !== binding.oldValue) {
|
||
|
var imageUrl = binding.value;
|
||
|
axios({
|
||
|
method: "get",
|
||
|
url: imageUrl,
|
||
|
responseType: "arraybuffer"
|
||
|
}).then(function(resp) {
|
||
|
var mimeType = resp.headers["content-type"].toLowerCase();
|
||
|
var imgBase64 = new Buffer(resp.data, "binary").toString("base64");
|
||
|
el.src = "data:" + mimeType + ";base64," + imgBase64;
|
||
|
}).catch(function() {
|
||
|
el.src = imageUrl;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
vueAuthImage.install = function(Vue2) {
|
||
|
Vue2.directive("auth-image", {
|
||
|
bind: function(el, binding) {
|
||
|
setImgSrc(el, binding);
|
||
|
},
|
||
|
componentUpdated: function(el, binding) {
|
||
|
setImgSrc(el, binding);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
if (typeof exports == "object") {
|
||
|
module.exports = vueAuthImage;
|
||
|
} else if (typeof define == "function" && define.amd) {
|
||
|
define([], function() {
|
||
|
return vueAuthImage;
|
||
|
});
|
||
|
} else if (window.Vue) {
|
||
|
window.VueAuthImage = vueAuthImage;
|
||
|
Vue.use(vueAuthImage);
|
||
|
}
|
||
|
})();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// dep:vue-auth-image
|
||
|
var vue_auth_image_default = require_vue_auth_image();
|
||
|
export {
|
||
|
vue_auth_image_default as default
|
||
|
};
|
||
|
//# sourceMappingURL=vue-auth-image.js.map
|