mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[Build] revert site to webpack config (#3747)
This commit is contained in:
33
docs/site/utils/index.js
Normal file
33
docs/site/utils/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function iframeReady(iframe, callback) {
|
||||
const doc = iframe.contentDocument || iframe.contentWindow.document;
|
||||
const interval = () => {
|
||||
if (iframe.contentWindow.changePath) {
|
||||
callback();
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
interval();
|
||||
}, 50);
|
||||
}
|
||||
};
|
||||
|
||||
if (doc.readyState === 'complete') {
|
||||
interval();
|
||||
} else {
|
||||
iframe.onload = interval;
|
||||
}
|
||||
}
|
||||
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
|
||||
|
||||
function importAll(map, r) {
|
||||
r.keys().forEach(key => {
|
||||
map[key] = r(key);
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
isMobile,
|
||||
importAll,
|
||||
iframeReady
|
||||
};
|
Reference in New Issue
Block a user