feat(init): 初始化远程组件项目
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export const customTheme = {
|
||||
colors: {
|
||||
primary: '#4338CA',
|
||||
secondary: '#03DAC6',
|
||||
success: '#4CAF50',
|
||||
info: '#2196F3',
|
||||
warning: '#FB8C00',
|
||||
error: '#FC3C56',
|
||||
surface: '#FFFFFF',
|
||||
background: '#F5F5F5'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 将URL转为blob
|
||||
*
|
||||
* @param url
|
||||
* @constructor
|
||||
*/
|
||||
export const ImageUrlToBlob = async (url: string): Promise<Blob> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch(url)
|
||||
.then((r) => r.blob())
|
||||
.then((blob) => {
|
||||
resolve(blob);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
export function loadRemoteStyle(url: string) {
|
||||
if (!document.getElementById(url)) {
|
||||
const link = document.createElement("link");
|
||||
link.id = url;
|
||||
link.rel = "stylesheet";
|
||||
link.href = url;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user