baixingwenzheng-pc/node_modules/.vite/vue-wechat-title.js
2024-08-02 18:19:39 +08:00

54 lines
1.8 KiB
JavaScript

import {
__commonJS
} from "./chunk-A5ICIBVI.js";
// node_modules/vue-wechat-title/vue-wechat-title.js
var require_vue_wechat_title = __commonJS({
"node_modules/vue-wechat-title/vue-wechat-title.js"(exports, module) {
(function() {
function install(Vue2) {
var setWechatTitle = function(title, img) {
if (title === void 0 || window.document.title === title) {
return;
}
document.title = title;
var mobile = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(mobile)) {
var iframe = document.createElement("iframe");
iframe.style.display = "none";
var _img = /alipay/.test(mobile) ? img : img || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
_img && iframe.setAttribute("src", _img);
var iframeCallback = function() {
setTimeout(function() {
iframe.removeEventListener("load", iframeCallback);
document.body.removeChild(iframe);
}, 0);
};
iframe.addEventListener("load", iframeCallback);
document.body.appendChild(iframe);
}
};
Vue2.directive("wechat-title", function(el, binding) {
setWechatTitle(binding.value, el.getAttribute("img-set") || null);
});
}
if (typeof exports === "object") {
module.exports = install;
} else if (typeof define === "function" && define.amd) {
define([], function() {
return install;
});
} else if (window.Vue) {
Vue.use(install);
}
})();
}
});
// dep:vue-wechat-title
var vue_wechat_title_default = require_vue_wechat_title();
export {
vue_wechat_title_default as default
};
//# sourceMappingURL=vue-wechat-title.js.map