This commit is contained in:
tangly1024.com
2023-08-07 18:22:39 +08:00
parent 9197b3c6bb
commit cfab52c569
8 changed files with 9501 additions and 29 deletions

View File

@@ -24,11 +24,14 @@ export const memorize = (Component) => {
*/
export function loadExternalResource(url, type) {
// 检查是否已存在
const elements = document.querySelectorAll(`[href='${url}']`)
if (elements.length > 0 || !url) {
return
}
const elements = type === 'js' ? document.querySelectorAll(`[src='${url}']`) : document.querySelectorAll(`[href='${url}']`)
return new Promise((resolve, reject) => {
if (elements.length > 0 || !url) {
resolve(url)
return url
}
let tag
if (type === 'css') {