|
@@ -5,6 +5,7 @@ import TintImageWorker from '@/utils/image.worker?worker'
|
|
|
import useMainStore from '@/store/main'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import analyze from 'rgbaster'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
export type RGBA = number[]
|
|
|
|
|
|
export type Point = [number, number]
|
|
@@ -88,6 +89,7 @@ export const useSetImgBg = (option: Ref<SetImgBgOption>, frontColor?: Ref<string
|
|
|
}
|
|
|
})
|
|
|
const initImage = async ({ image, frontColor, setFrontColor }: InitOption) => {
|
|
|
+ const filePath = image as string
|
|
|
if (!image) {
|
|
|
return console.warn(`return for img define ${image}`)
|
|
|
}
|
|
@@ -125,6 +127,7 @@ export const useSetImgBg = (option: Ref<SetImgBgOption>, frontColor?: Ref<string
|
|
|
}
|
|
|
img.onerror = () => {
|
|
|
console.log('img error')
|
|
|
+ ElMessage.error('图片渲染失败:' + filePath)
|
|
|
reject()
|
|
|
}
|
|
|
img.onabort = () => {
|