Vue 组件有一个照片块和“编辑”按钮。
<template>
<div>
<tui-image-editor ref="editor" > </tui-image-editor>
<div class="">
<img :src="img">
<button @click="edit()">Edit</button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
img: "cdn.domain.shop/eaa49b02e350627622904290a83599d6.png",
};
},
methods: {
edit() {
this.$refs.editor.invoke("loadImageFromURL", this.img, "Editable image");
},
},
};
</script>
作为照片编辑器,我使用TUI 图像编辑器。在点击处理程序中,我通过loadImageFromURL函数将 url 传递给编辑器
当我在 Windows 中单击 Chrome 中的“编辑”按钮时出现错误
从源“example.org”访问“cdn.domain.shop/eaa49b02e350627622904290a83599d6.png”图像已被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin”标头。
但是当我在 Ubuntu 的 Chrome 中做同样的事情时,一切正常。
我究竟做错了什么?