-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
能用网络图片作为logo图片吗? #74
Comments
不跨域的就可以 |
感觉很麻烦🤣 |
getImageToBase64 (url) { // 将外网图片url转为本地base64
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
try {
let axios = await import('axios')
axios = axios.default
const { data } = await axios.get(url, { responseType: 'blob', headers: { 'Access-Control-Allow-Origin': '*' } })
const reader = new FileReader()
reader.readAsDataURL(data)
reader.onloadend = function () {
const base64data = reader.result
resolve(base64data)
}
} catch (error) {
reject(error)
}
})
} 我用的这种方法 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
logoSrc想支持网络图片地址url
The text was updated successfully, but these errors were encountered: