Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9badb7d

Browse files
authored
add optional "crossorigin" attribute to image (Agontuk#72)
usage: <vue-cropper crossorigin="anonymous" ... /> solves: "Failed to execute 'toDataURL' Tainted canvases may not be exported" see: fengyuanchen/cropperjs#258
1 parent a2c4e34 commit 9badb7d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

VueCropper.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ const previewPropType = typeof window === 'undefined'
66

77
export default {
88
render(h) {
9+
const crossorigin = this.crossorigin || undefined;
10+
911
return h('div', { style: this.containerStyle }, [
1012
h('img', {
1113
ref: 'img',
1214
attrs: {
1315
src: this.src,
1416
alt: this.alt || 'image',
15-
style: 'max-width: 100%'
17+
style: 'max-width: 100%',
18+
crossorigin
1619
},
1720
on: this.$listeners,
1821
style: this.imgStyle
@@ -52,6 +55,9 @@ export default {
5255
type: Boolean,
5356
default: true
5457
},
58+
crossorigin: {
59+
type: String,
60+
},
5561
modal: {
5662
type: Boolean,
5763
default: true

0 commit comments

Comments
 (0)