File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -135,15 +135,19 @@ export default defineComponent({
135
135
const loadScript = (scriptPath ) => {
136
136
return new Promise (function (resolve , reject ) {
137
137
let tag = document .head .querySelector (` [src="${ scriptPath} "` );
138
- tag = document .createElement (" script" );
139
- tag .src = scriptPath;
140
- document .head .appendChild (tag);
141
- tag .onload = () => {
138
+ if (tag) {
142
139
resolve (tag);
143
- };
144
- tag .onerror = () => {
145
- reject (new Error (" Failed to load " + scriptPath));
146
- };
140
+ } else {
141
+ tag = document .createElement (" script" );
142
+ tag .src = scriptPath;
143
+ document .head .appendChild (tag);
144
+ tag .onload = () => {
145
+ resolve (tag);
146
+ };
147
+ tag .onerror = () => {
148
+ reject (new Error (" Failed to load " + scriptPath));
149
+ };
150
+ }
147
151
});
148
152
};
149
153
const scriptsToLoad = [
You can’t perform that action at this time.
0 commit comments