VueJS 3,Webpack 尝试读取它无权访问的外部 CSSStyleSheet
DOMException:无法从“CSSStyleSheet”读取“cssRules”属性:无法访问规则
我知道这是什么以及为什么会发生这种情况,这不是“这是什么错误”问题,也不是该问题的重复.
非常具体:
使用 VueJS 3 和 google 地图 api,webpack 尝试遍历来自 google 的样式表,但由于跨站点保护,这将无法工作。这完全没问题,但是为什么它首先要尝试这样做,我该如何让它不这样做呢?
DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules
I know what this is and why this happens, this is not a "what is this error" question and is not a duplicate of that question.
Very specifically:
Using VueJS 3 and google maps api, webpack is attempting to traverse the style sheets from google, which won't work because of cross site protections. That's perfectly fine, but why is it attempting this in the first place and how do I make it just not do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
reactive
正在进行深度反应式转换。shallowReactive
还不够,因为它仍然进行反应式转换 顶级对象及其属性。你想要的是 shallowRef
reactive
is doing deep reactive conversion.shallowReactive
is not enough because it still does reactive conversion of the top level object and it's properties.What you want is shallowRef
几周前我遇到过一次,终于弄清楚了,然后再次遇到它并忘记了我是如何弄清楚的。万一其他人过来(你好,未来的我):
将地图对象从
window.google.maps.Map
转换为reactive
会导致 Vue/webpack 尝试遍历整个对象,包括对该对象中样式表的引用shallowReactive
也不起作用。I ran into this once weeks ago, finally figured it out, then ran into it again and forgot how I figured it out. In case someone else comes by (hello, future me):
Turning the map object from
window.google.maps.Map
into areactive
causes Vue/webpack to attempt to traverse the entire object, including references to stylesheets in that objectshallowReactive
doesn't work either.