11

Vue3问题总结

 4 years ago
source link: https://segmentfault.com/a/1190000040283451
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Uncaught DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

vue3+vue-router4在使用过程中,通过composition api watchrouter对象进行监听时,会出现这个问题。

import { useRoute } from 'vue-router'
const route = useRoute()
watch(
      route,
      (to, from) => {
        // do something
      }
    )

解决办法,别监听整个router对象,改为监听其某个属性,如监听path的变化就可以了。

Uncaught (in promise) DOMException: Failed to read the 'value' property from 'SVGLength': Could not resolve relative length.

项目中用到了svg,同时做了svg根据主题色进行换色处理的功能(监听了路由的变化去处理),打包部署后出现这个问题,解决办法如第一个。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK