mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-26 07:26:49 +00:00
fukasawa减少动画、并支持调整;
图片画质参数支持调节; 博客支持外链文章
This commit is contained in:
27
lib/utils.js
27
lib/utils.js
@@ -30,6 +30,33 @@ export const memorize = (Component) => {
|
||||
}
|
||||
return memo(MemoizedComponent)
|
||||
}
|
||||
|
||||
// 转换外链
|
||||
export function sliceUrlFromHttp(str) {
|
||||
// 检查字符串是否包含http
|
||||
if (str.includes('http')) {
|
||||
// 如果包含,找到http的位置
|
||||
const index = str.indexOf('http');
|
||||
// 返回http之后的部分
|
||||
return str.slice(index, str.length);
|
||||
} else {
|
||||
// 如果不包含,返回原字符串
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否外链
|
||||
export function checkContainHttp(str) {
|
||||
// 检查字符串是否包含http
|
||||
if (str.includes('http')) {
|
||||
// 如果包含,找到http的位置
|
||||
return str.indexOf('http') > -1
|
||||
} else {
|
||||
// 不包含
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载外部资源
|
||||
* @param url 地址 例如 https://xx.com/xx.js
|
||||
|
||||
Reference in New Issue
Block a user