Skip to content

Commit 50f9988

Browse files
iamkunoleksiikhr
authored andcommitted
update inner check (ElemeFE#16700)
1 parent 6c7375a commit 50f9988

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

examples/components/header.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380
import compoLang from '../i18n/component.json';
381381
import Element from 'main/index.js';
382382
import themeLoader from './theme/loader';
383-
import { getTestEle, getTestAli } from './theme/loader/api.js';
383+
import { getTestEle } from './theme/loader/api.js';
384384
import bus from '../bus';
385385
import { ACTION_USER_CONFIG_UPDATE } from './theme/constant.js';
386386
@@ -434,15 +434,17 @@
434434
ga('send', 'event', 'DocView', 'Ele', 'Outer');
435435
console.error(err);
436436
});
437-
getTestAli()
438-
.then(() => {
439-
this.$isEle = true;
440-
ga('send', 'event', 'DocView', 'Ali', 'Inner');
441-
})
442-
.catch((err) => {
443-
ga('send', 'event', 'DocView', 'Ali', 'Outer');
444-
console.error(err);
445-
});
437+
438+
const testInnerImg = new Image();
439+
testInnerImg.onload = () => {
440+
this.$isEle = true;
441+
ga('send', 'event', 'DocView', 'Ali', 'Inner');
442+
};
443+
testInnerImg.onerror = (err) => {
444+
ga('send', 'event', 'DocView', 'Ali', 'Outer');
445+
console.error(err);
446+
};
447+
testInnerImg.src = `https://private-alipayobjects.alipay.com/alipay-rmsdeploy-image/rmsportal/VmvVUItLdPNqKlNGuRHi.png?t=${Date.now()}`;
446448
},
447449
methods: {
448450
switchVersion(version) {

examples/components/theme/loader/api.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ export const getTestEle = () => {
1919
return get(`${hostList.alpha}getVariable`);
2020
};
2121

22-
export const getTestAli = () => {
23-
return get(`https://private-alipayobjects.alipay.com/alipay-rmsdeploy-image/rmsportal/VmvVUItLdPNqKlNGuRHi.png?t=${Date.now()}`);
24-
};
25-
2622
export const updateVars = (data, cb) => {
2723
return post(`${host}updateVariable?version=${version}`, data, cb);
2824
};

0 commit comments

Comments
 (0)