mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-19 07:26:50 +00:00
4.0.12
This commit is contained in:
11
lib/utils.js
11
lib/utils.js
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user